SQL中的多值传递选择查询 [英] multiple value pass in sql select query

查看:149
本文介绍了SQL中的多值传递选择查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在选择查询(sql2005)的where子句中传递cheakeedlistbox值

how to pass cheakeedlistbox value in where clause in select query(sql2005)

推荐答案



好吧,一个起点就是掌握已检查的项目:

CheckedListBox-选定项 [ StringBuilder类和示例 [ ^ ]

最后,我不会将纯文本字符串传递到where子句中,应用程序将很容易受到SQL注入的影响,而是使用命名参数.

亲切的问候,
Hi,

Well a starting point would be, getting hold of the checked items:

CheckedListBox - Selected Item[^]

Secondly, StringBuilder is a great way of builing up the SQL string: StringBuilder Class and example[^]

Lastly, I would not pass the clear text string into the where clause, the application would become vulnerably to SQL injection, rather make use of named parameters.

Kind regards,


您需要将检查表框的值作为布尔值传递给查询.

例如如果选中了复选框,则where子句类似于where myColumn = true.
You need to pass the value of the checkedlistbox to the query as a boolean.

FOr e.g. if your checkbox is checked, your where clause would be something like where myColumn = true.


这篇关于SQL中的多值传递选择查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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