0
我有一個SQL數據庫表,我從中查詢我的c#項目。該表包含一個列,它將int作爲數據類型(僱主年齡)。我正在查詢這一列,並希望將從該列查詢的每條記錄加起來並顯示記錄的總數;從數據庫表中添加數據類型
代碼:
int AddAge;
string getAge;
Query = "SELECT * FROM TblEmp WHERE Id = '" + id + "' AND Position = '"+Manager+"'";
theReader = conn.ExecuteStatement(Query);
while(theReader.Read())
getAge = theReader["Age"].ToString();
AddAge = int.Parse(getAge);
AddAge + getAge; // this is where i am stuck, How can I add up the ages and display the the total?