“System.Data.SqlClient.SqlException”类型的未经处理的错误出现在 System.Data.dll 中。 求解释。
“System.Data.SqlClient.SqlException”类型的未经处理的异常出现在 System.Data.dll 中。 求解释。。。
------解决方案--------------------
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 写错了
------解决方案--------------------
自己不细心
------解决方案--------------------
- 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 写错了
------解决方案--------------------
自己不细心
------解决方案--------------------