一个C#的问题!请高手给予指导!
SqlConnection sqlconn = new SqlConnection( "server=localhost;database=master;uid=sa;pwd=123456 ");
sqlconn.Open();
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter( "select * from usersheet where name= "+textBox7.Text,sqlconn);
da.Fill(ds, "usersheet ");
textBox1.DataBindings.Add(textBox1.Text,ds, "usersheet.id ");
textBox2.DataBindings.Add(textBox2.Text,ds, "usersheet.name " );
textBox3.DataBindings.Add(textBox3.Text ,ds, "usersheet.pwd ");
textBox4.DataBindings.Add(textBox4.Text ,ds, "usersheet.wt ");
textBox5.DataBindings.Add(textBox5.Text, ds, "usersheet.answer ");
textBox6.DataBindings.Add(textBox6.Text,ds, "usersheet.email ");
sqlconn.Close();
为什么老提示{ "列名 'XX ' 无效。 "}
------解决方案--------------------1.select * from usersheet where name= "+textBox7.Text
---> select * from usersheet where name= ' "+textBox7.Text+ " ' "
2.DataBings的时候确保列名没有错误且存在