问一下,这个错在那里
protected void Button1_Click(object sender, EventArgs e){
if (!(TextBox1.Text == "" || TextBox2.Text == ""))
{
string connstr = ConfigurationManager.ConnectionStrings["OleDBconnstr"].ConnectionString;
string ss = "select count(*) from user where usname='" + TextBox1.Text.Trim().ToString() + "' and uspass='" + TextBox2.Text.Trim().ToString() + "'";
// cs.open();
OleDbConnection oleconn = new OleDbConnection(connstr);
OleDbCommand olecomm = new OleDbCommand();
olecomm.Connection = oleconn;
= ss;
oleconn.Open();
if (Convert.ToInt32(olecomm.ExecuteScalar()) > 0)
{
oleconn.Close();
Session["admin"] = this.TextBox1.Text.Trim().ToString();
Response.Write("<script>alert('欢迎你回来!');window.location.href='AddTeacher.aspx';</script>");
}
else
{
oleconn.Close();
Response.Write("<script language=" + "\"JavaScript\"" + ">alert('用户名密码错误?')</script>");
return;
}
}
else
{
Response.Write("<script language=" + "\"JavaScript\"" + ">alert('请输入用户名和密码!!')</script>");
return;
}
}
真不知道错在那里了,sql语句也是对的啊,他老说from子句语法错误