下面语句错在哪里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/07/05 22:00:18
![下面语句错在哪里OleDbCommand cmd2 = new OleDbCommand(](/uploads/image/z/10651333-13-3.jpg?t=%E4%B8%8B%E9%9D%A2%E8%AF%AD%E5%8F%A5%E9%94%99%E5%9C%A8%E5%93%AA%E9%87%8COleDbCommand+cmd2+%3D+new+OleDbCommand%28%22select+sum%28inv_sum_money%29%2A6.75+from+invoice+where+month%28post_date%29%3D%27%22+%2B+month+%2B%22+%27+and+paid_unit%3D%27USD%27%22%2Ccon%29%3Bstring+usd+%3D+cmd2.ExecuteScalar%28%29.ToString%28%29%3Bdouble+aaa+%3D+usd+%3D%3D+null+0+%3AConver)
下面语句错在哪里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或空也会报错