连接数据库有语法错误,
hebzy 2009-03-12 11:29:36 private void buttonOK_Click(object sender, EventArgs e)
{
Conn con =new Conn(this.textBox1.Text);
SqlConnection sqlConncetion = con.creatConn();
SqlCommand cmd =new SqlCommand("SELECT COUNT(*) FROM User WHERE username ='"+this.textBox3.Text+"' AND password ='"+this.textBox4.Text+"'",sqlConncetion);
String temp = cmd.ExecuteScalar().ToString();
就是这句,说我在USER附近有语法错误,
问题是我是看不出来哪里错了呀。
帮我瞧瞧
cmd.Connection.Close();
if (temp == "1")
{
this.Visible = false;
Main main = new Main();
main.ShowDialog();
}
else
{
MessageBox.Show("登录名或密码错误", "系统提示");
}
}