[求助]代码问题
private void button1_Click(object sender, EventArgs e){
SqlConnection newSqlConnection = new SqlConnection(
"server=localhost;database=Student;integrated security=SSPI");
SqlCommand newSqlCommand = newSqlConnection.CreateCommand();
newSqlCommand.CommandText = "select count(*) from 用户表 where 用户名='" + textBox1.Text + "'";
newSqlConnection.Open();
SqlDataReader newSqlDataReader = newSqlCommand.ExecuteReader();
newSqlDataReader.Read();
int returnValue=(int)newSqlCommand.ExecuteScalar();
if (returnValue!=0)
if (textBox2.Text == newSqlDataReader[1])
{
Form2 newForm = new Form2();
newForm.Show();
}
else
MessageBox.Show("用户名或密码错误");
else
MessageBox.Show("用户名或密码错误");
newSqlDataReader.Close();
newSqlConnection.Close();
}
请问这段登录代码有什么错误?
帮忙解决一下