sql修改数据,报错incorrect syntax near '='求各位大神帮帮忙QAQ
string strcon = "Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=D:\\学习\\rfid\\a\\WindowsFormsApplication1\\WindowsFormsApplication1\\数据库\\shujuku.mdf;Integrated Security=True;Connect Timeout=30"; //连接数据库的字符串
SqlConnection conn = new SqlConnection(strcon); //实例化并定义一个数据库连接
conn.Open(); //打开数据库连接
string sql = "updata reader set username=N' " + textBox2.Text + " ',userpassword=' " + textBox3.Text + " ' where usernum=' " + textBox1.Text +" ' ";
SqlCommand cmd = new SqlCommand(sql, conn); //实例化并定义sql语句和数据库路径
int i = cmd.ExecuteNonQuery();
conn.Close();
if (i > 0)
{
this.textBox1.Clear();
this.textBox2.Clear();
this.textBox3.Clear();
MessageBox.Show("用户修改成功!");
}
else
{
MessageBox.Show("用户修改失败!");
}