这个更新语句有什么问题 [英] What is the problem with this update statement

查看:97
本文介绍了这个更新语句有什么问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此更新声明有什么问题?任何人帮助我



UpdateQueryString =UPDATE tblLogin SET loginName = @ name,Password = @password,EmpID = @tempEmId WHERE LoginID = @tempLogId;



请帮帮我



我尝试了什么:



UpdateQueryString =UPDATE tblLogin SET loginName = @ name,Password = @password,EmpID = @tempEmId WHERE LoginID = @tempLogId;



错误:必须声明标量变量@name。

What problem is with this update statement? Any one help me

UpdateQueryString = "UPDATE tblLogin SET loginName= @name, Password= @password, EmpID= @tempEmId WHERE LoginID= @tempLogId";

please help me

What I have tried:

UpdateQueryString = "UPDATE tblLogin SET loginName= @name, Password= @password, EmpID= @tempEmId WHERE LoginID= @tempLogId";

Error: must declare scalar variable "@name".

推荐答案

该语句没有任何问题。您需要为@ name,@ password,@ tempEmId和@tempLogId设置参数,为它们分配适当的值,并将它们分配给命令。
There's nothing wrong with the statement. You need to set up parameters for @name, @password, @tempEmId and @tempLogId, assign the appropriate values to them, and assign them to the command.


是的,添加的最后一个参数是错误的



yeah last parameter added is wrong

UpdateCommand.Parameters.AddWithValue("@EmID", tempEmId);







它应该是






It should be

UpdateCommand.Parameters.AddWithValue("@tempEmId", tempEmId);





还有一个





and one more

UpdateCommand.Parameters.AddWithValue("@tempLogId", tempLogId);





仔细检查拼写,不要。所需的参数。你只需要四个参数



@name

@password

@tempEmId

@tempLogId



Carefully check the spellings and no. of parameters required. You only need four parameters

@name
@password
@tempEmId
@tempLogId


这篇关于这个更新语句有什么问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆