数据库问题
/// <summary>/// 返回购物袋所有商品的总额
/// </summary>
/// <returns></returns>
public static string CommodityTotal()
{
SqlCommand comm = new SqlCommand("Select sum(总价) From 购物袋", conn);
string sum = "0";
conn.Open();
if (comm.ExecuteNonQuery() != 0)
sum = comm.ExecuteScalar().ToString();
conn.Close();
return sum;
}
购物袋表里面并没有数据,为什么if语句却通过了?