本文介绍了如何将sql查询放在表格中的一列中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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知道错了,但我希望你明白我的观点:)
i know its wrong but i hope you get my point :)
推荐答案
这篇关于如何将sql查询放在表格中的一列中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!