我有以下代碼。獲取查詢的int值
string connStr = String.Format("server=localhost;user id=root; password=1234;" + "database=Printermangement; pooling=false", "localhost", "root", "1234");
string Query = "select sum(Page_Printed) from printjobdetails where User_ID = 'MyProperty'GROUP by User_ID";
MySqlConnection conDataBase = new MySqlConnection(connStr);
MySqlCommand cmdDataBase = new MySqlCommand(Query, conDataBase);
MessageBox.Show(Query);
我想從這個查詢sum
,但我無法弄清楚如何獲得int
值在消息框中顯示。我怎樣才能做到這一點?
'MessageBox.Show(Query);'顯示查詢,而不是結果。 –