[求助]登录代码!
我想做一个用户登录界面,但我发现我private void button1_Click(object sender, EventArgs e){
SqlConnection newSqlConnection = new SqlConnection(
"server=localhost;database=Student;integrated security=SSPI");
SqlDataAdapter da = new SqlDataAdapter("select count(*) from 用户表 where 用户名='" + textBox1.Text.Trim() + "' and 密码='" + textBox2.Text.Trim() + "'",newSqlConnection);
DataSet ds = new DataSet();
da.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
Form2 newForm = new Form2();
this.Hide();
newForm.Show();
}
else
{
MessageBox.Show("用户名或密码错误");
return;
}
}
}写的代码不能实现此功能,自己又找不出原因,请大家给予指点