更新不使用参数检查代码 [英] update not working using parameters check the code

查看:66
本文介绍了更新不使用参数检查代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

声明@abc varchar(20)

设置@ abc ='abc'

更新表设置xxx = @ abc其中ass = '23'

解决方案

当您收到错误时,通常也会收到错误消息 - 它提供了有关系统在您的代码中发现的问题的重要信息。如果没有这个,你会让我们的工作变得更多,更难... ...



试试这个:

 更新 []  SET  xxx = @abc  WHERE  ass = '  23' 



table 是一个SQL关键字,所以你需要让它知道你的意思是你的表叫做table代替。


Declare @abc varchar(20)
Set @abc ='abc '
Update table set xxx =@abc where ass ='23'

解决方案

When you get an error, you normally get an error message as well - and it provides important information as to what problem the system has found with your code. And without that, you make our job a lot, lot harder...

Try this:

UPDATE [table] SET xxx =@abc WHERE ass ='23'


table is an SQL keyword, so you need to let it know that you mean your table called "table" instead.


这篇关于更新不使用参数检查代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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