【发布时间】:2012-01-16 00:03:06
【问题描述】:
我是 Visual Studio 的新手,我想让用户在查询中输入一个值
即搜索我将使用的员工
Select * From Employee Where ID = (i want the user to enter the value here)
我已经连接了数据库 我知道我可以从文本框中获取值,但我真的不知道如何将该值直接放入查询中并立即调用它
【问题讨论】:
-
你试过什么?你可以发布你的代码吗?试试这个顺便说一句。 "Select * From Employee Where ID = "+TextBox1.Text;
-
@sh4nx0r 不好的建议,允许 SQL 注入。使用参数化查询。
标签: sql sql-server database visual-studio-2010 sql-server-2012