下面语句错在哪里OleDbCommand cmd2 = new OleDbCommand("select sum(inv_sum_money)*6.75 from invoice where month(post_date)='" + month +" ' and paid_unit='USD'",con);string usd = cmd2.ExecuteScalar().ToString();double aaa = usd == null 0 :Conver

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/28 16:16:31
下面语句错在哪里OleDbCommand cmd2 = new OleDbCommand(

下面语句错在哪里OleDbCommand cmd2 = new OleDbCommand("select sum(inv_sum_money)*6.75 from invoice where month(post_date)='" + month +" ' and paid_unit='USD'",con);string usd = cmd2.ExecuteScalar().ToString();double aaa = usd == null 0 :Conver
下面语句错在哪里
OleDbCommand cmd2 = new OleDbCommand("select sum(inv_sum_money)*6.75 from invoice where month(post_date)='" + month +" ' and paid_unit='USD'",con);
string usd = cmd2.ExecuteScalar().ToString();
double aaa = usd == null 0 :Convert.ToDouble(usd);
Response.Write(aaa);
当符合查询条件的记录为空时报错:
倒数第2句报错,输入字符窜的格式不正确,将一个字符串转换为DateTime的时候,先分析该字符串以获取日期,然后将每个变量放置到DateTime对象中
我不明白我根本没有转换datetiem类型啊,为什么会报错!

下面语句错在哪里OleDbCommand cmd2 = new OleDbCommand("select sum(inv_sum_money)*6.75 from invoice where month(post_date)='" + month +" ' and paid_unit='USD'",con);string usd = cmd2.ExecuteScalar().ToString();double aaa = usd == null 0 :Conver
Convert.ToDouble(usd);
转化为double,只有符合double的字符串才能转哦,null或空也会报错