本文介绍了检索数据时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何检索数据
i使用email_id nvarchar(50)创建一个表客户为pk,cust_name nvarchar(50),cust_address nvarchar(50)
现在我希望根据电子邮件地址重新检查客户名称
i执行以下操作:
此处textbox1是用户输入的电子邮件ID
受保护 void Button1_Click( object sender,EventArgs e)
{
string s = TextBox1.Text;
objcus.name(s);
}
public void name( string emailid)
{
int add = s.DMLQuery( 从Tbl_Customer中选择Customer_Name,其中Email_Id = + emailid);
}
public int DMLQuery( string SqlCommandText )
{
Sqlconn = new SqlConnection(StrSqlconnection);
Sqlconn.Open();
sqlcmd = new SqlCommand();
sqlcmd.CommandText = SqlCommandText;
sqlcmd.Connection = Sqlconn;
int i = sqlcmd.ExecuteNonQuery();
return i;
}
我收到int i = sqlcmd.ExecuteNonQuery();作为多部分标识符[email protected]无法绑定。
请回答我错过的内容
关于
解决方案
how to retrive data
i created one table customer with email_id nvarchar(50) as p.k,cust_name nvarchar(50),cust_address nvarchar(50)
now in form i want to retrive customer name depending upon email address
i performed following:
here textbox1 is email id entered by user
protected void Button1_Click(object sender, EventArgs e) { string s = TextBox1.Text; objcus.name(s); }
public void name(string emailid) { int add = s.DMLQuery("select Customer_Name from Tbl_Customer where Email_Id =" + emailid); }
public int DMLQuery(string SqlCommandText) { Sqlconn = new SqlConnection(StrSqlconnection); Sqlconn.Open(); sqlcmd = new SqlCommand(); sqlcmd.CommandText = SqlCommandText; sqlcmd.Connection = Sqlconn; int i = sqlcmd.ExecuteNonQuery(); return i; }
i am getting error on int i = sqlcmd.ExecuteNonQuery(); as " The multi-part identifier "[email protected]" could not be bound."
pls teell what i missed
regards
解决方案
这篇关于检索数据时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!