DateTime thisday = DateTime.Now;
MySqlConnection con = new MySqlConnection("Server=localhost;UID=root;Database=db_cignal");
con.Open();
MySqlCommand cmd = con.CreateCommand();
cmd.CommandText = "insert into revenue(Year,Newsales,Beginninginventory,Purchases,Goodforsales,Endinventory,Costofsales,Salesandwages,sss,Rental,Postage,Lightandwater,Freight,Fuel,Officesupplies,Taxesandlicenses,Representation,Depreciation,Transportation,Repairs,Miscellaneous,Totaloperatingexpense,Provisions,Netincomefinal)values(@one,@two,@three,@four,@five,@six,@seven,@eight,@nine,@ten,@eleven,@twelve,@thirteen,@fourteen,@fifteen,@sixteen,@seventeen,@eighteen,@nineteen,@twenty,@twentyone,@twentytwo,@twentythree,@twenthfour,@twentyfive)";
cmd.Parameters.AddWithValue("@one", thisday.ToString("d"));
cmd.Parameters.AddWithValue("@two", TotalPriceQuery());
private void TotalPriceQuery()
{
MySqlConnection con = new MySqlConnection("Server=localhost;UID=root;Database=db_cignal");
con.Open();
MySqlCommand cmd = con.CreateCommand();
cmd.CommandText = "SELECT SUM(TotalPrice) FROM inventoryout";
cmd.Prepare();
cmd.ExecuteNonQuery();
con.Close();
}
i know its wrong but i hope you get my point :)