防止SQL注入 [英] prevent sql injection
本文介绍了防止SQL注入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有一种方法可以通过使用存储过程来防止sql注入?
Is there a way to prevent sql injection by using stored procedures?
我有一个sql查询,
select column name from table where field ='@value'
cmd.parameters.add('@value', value);
我正在使用具有最小特权的参数化查询.我如何编写基本的存储过程来防止sql注入.有可能吗?
I am using parameterized queries with least privileges. How can i write a basic stored procedure to prevent an sql injection. Is that possible?
推荐答案
select column name from table where field =@value
cmd.parameters.add('@value', value);
SQL参数避免了sql注入问题.
SQL Parameters avoid the sql injection problem.
您只需要使用参数更改=条件.检查以上查询.
You just need to change the = condition with parameter. check above query.
这篇关于防止SQL注入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文