保存撇号“ ''在sql中 [英] save apostrophe " ' " in sql

查看:110
本文介绍了保存撇号“ ''在sql中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



i将此语句发送给sql:



 插入  tableName(fieldName)' 杰克'的汽车'  





为了节省

但是发生错误



感谢您解决问题

解决方案

可能错误信息是:

消息105,级别15,状态1,行xxx 
字符串后的未闭合引号< / pre>





To解决方法是你必须添加另一个'



 插入 进入 tableName(fieldName)' 杰克的车'





作为 Afzaal [ ^ ]建议,我需要警告你 SQL注入 [ ^ ]。



更多:如何:防止ASP.NET中的SQL注入 [ ^ ]

SQL注入以及如何避免它[ ^ ]

存储过程是否可以防止SQL注入? [ ^ ]

SQL注入攻击 [ ^ ]


hi
i sent this statement to sql:

insert into tableName (fieldName) values ('Jack's car')



in order to Save
But an error occurred

Thanks for any solution to the problem

解决方案

Probably, an error message is: "

Msg 105, Level 15, State 1, Line xxx
Unclosed quotation mark after the character string</pre>



To workaround it you have to add another '.

insert into tableName (fieldName) values ('Jack''s car')



As Afzaal[^] suggested, i need to warn you about SQL Injection[^].

More: How To: Protect From SQL Injection in ASP.NET[^]
SQL Injection and how to avoid it[^]
Do Stored Procedures Protect Against SQL Injection?[^]
SQL Injection Attacks[^]


这篇关于保存撇号“ ''在sql中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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