首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

“System.Data.SqlClient.SqlException”类型的未经处理的错误出现在 System.Data.dll 中。 求解释。

2012-03-09 
“System.Data.SqlClient.SqlException”类型的未经处理的异常出现在 System.Data.dll 中。 求解释。。。C# code

“System.Data.SqlClient.SqlException”类型的未经处理的异常出现在 System.Data.dll 中。 求解释。。。

C# code
                        druser.Dispose();                         SqlCommand cmdTime = new SqlCommand("select datediff(hour,firsttime,GETDATE()) FROM tb_user where usernum='" + str + "' ", con);                        textBox1.Text = cmdTime.ExecuteScalar().ToString();                        int sj = Convert.ToInt32(textBox1.Text);                        SqlCommand cmdclear = new SqlCommand("updata tb_user set firsttime='" + now + "',sum=sum+sj where usernum='" + str + "'", con);                        cmdclear.ExecuteScalar();/*运行到这时出现  “System.Data.SqlClient.SqlException”类型的未经处理的异常出现在 System.Data.dll 中。其他信息: '=' 附近有语法错误。*/                        con.Close();


[解决办法]
sum 在数据库什么类型
[解决办法]
select datediff(hour,firsttime,GETDATE()) FROM tb_user where usernum='" + str + "' "
sql出问题了,看看str 是什么
[解决办法]
updata tb_user set firsttime='" + now + "',[sum]=[sum]+sj where usernum='" + str + "'"
[解决办法]
update 写错了
[解决办法]
自己不细心
[解决办法]
探讨
update 写错了

热点排行