我不断收到错误“NullReferenceException 未处理。对象引用未设置为对象的实例”在第 5 行
1. Private void textbox1_TextChanged(object sender,EventArgs e)
2 {
3. SqlConnection cn=new SqlConnection("Connection string");
4. String sql ="select name from bank_info where account_no ='"+textbox1.Text+"'";
5. SqlCommand cmd =new SqlCommand(sql,cn);
6. Cn.Open();
7. String s1 = cmd.ExecuteScalar().ToString();
8. TextBox2.Text =s1.ToString();
我是编程新手。谢谢