“系统”附近的语法不正确。 [英] Incorrect syntax near 'System'.
本文介绍了“系统”附近的语法不正确。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
protected void Button1_Click(对象发件人,EventArgs e)
{
SqlConnection con = new SqlConnection( data source = .; database = MRC_Database; integrated security = true;);
con.Open();
SqlDataAdapter da = new SqlDataAdapter();
string updatestr = 更新User_Account set F_name = + txtFname + ,L_name =' + txtLname + ,phone_no =' + txtPhone +
,PassUser =' + txtNewPass + , ReEnter_password =' + txtReEnterPass + ,AlternateEmail =' + txtAlternateEmail +
'where Email =' + LblEmail + ';
SqlCommand com = new SqlCommand(updatestr,con);
da.UpdateCommand = com;
com.ExecuteNonQuery();
con.Close();
}
解决方案
您在密码之后和备用电子邮件之前错过了转义('')。
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("data source=.;database=MRC_Database;integrated security=true;");
con.Open();
SqlDataAdapter da = new SqlDataAdapter();
string updatestr = " Update User_Account set F_name=" + txtFname + ",L_name='" + txtLname + ", phone_no ='" + txtPhone +
",PassUser='" + txtNewPass + ",ReEnter_password='" + txtReEnterPass + ", AlternateEmail ='" + txtAlternateEmail +
"' where Email='" + LblEmail + "'";
SqlCommand com = new SqlCommand(updatestr, con);
da.UpdateCommand = com;
com.ExecuteNonQuery();
con.Close();
}
解决方案
You missed an escape ('') after the password and before alternate email.
这篇关于“系统”附近的语法不正确。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文