如何根据textfiled值选择数据? [英] How to select data based on textfiled value?
本文介绍了如何根据textfiled值选择数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用ADO.net根据我已经拥有的文本字段数据从SQL服务器检索几个文本字段的数据。现在,当我试图查询数据库时,遇到必须声明标量变量的问题。
我尝试过:
I am using ADO.net to retrieve couple of text field's data from SQL server based on a text field data which I have already. Now When I am trying to query the database , having issue like Must declare the scalar variable .
What I have tried:
using (SqlCommand cmd = new SqlCommand("Select * from tblAcc where " + " uid = @txtsysuser", conn))
推荐答案
您正在指定一个参数,但之后却没有提供它。
You are specifying a parameter, but then not supplying it.
using (SqlCommand cmd = new SqlCommand("Select * from tblAcc where uid = @txtsysuser", conn))
{
cmd.Parameters.AddWithValue("@txtsysuser", valueToCompareTheUIDTo);
...
}
这篇关于如何根据textfiled值选择数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文