在SQL WHERE子句中使用变量或文本框 [英] Use a variable or text box in SQL WHERE clause

查看:95
本文介绍了在SQL WHERE子句中使用变量或文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在SQL where子句中指定变量或文本框。我很难用变量或测试框替换下面代码中显示的IN PRODUCTION。我的愿望是使用一个变量,但文本框不可能这样做。



我尝试过:



I need to specify a variable or text box in a SQL where clause. I am having a very difficult time replacing ‘IN PRODUCTION’ shown in the below code with a variable or test box. My desire is to use a variable, but is that is not possible a text box will do.

What I have tried:

FROM tbl_Switches WHERE Status = 'IN PRODUCTION' ORDER BY Node", cs)

推荐答案

使用参数化查询:如何使用Microsoft .Net参数化查询修复SQL注入 [ ^ ]
Use a parameterized query: How to Fix SQL Injection Using Microsoft .Net Parameterized Queries[^]


这篇关于在SQL WHERE子句中使用变量或文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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