string sql = "select * from user where user_name='" +t1.Text.Trim()+ "' and user_password='"+t2.Tex
string sql = "select * from user where user_name='" +t1.Text.Trim()+ "' and user_password='"+t2.Text.Trim()+ "'";错在哪里啊?
protected void Button1_Click(object sender,EventArgs e)
{
string str="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server .MapPath ("App_Data/user.mdb");
OleDbConnection conn = new OleDbConnection(str);
conn.Open();
string sql = "select * from user where user_name='" +t1.Text.Trim()+ "' and user_password='"+t2.Text.Trim()+ "'";
OleDbCommand oledbcommand = new OleDbCommand(sql,conn);
OleDbDataReader rd = oledbcommand.ExecuteReader();
int add=0;
while (rd.Read()) { add++; }
if(add ==0){
Response .Write ("需要进入系统!");}
else
{ Response .Redirect ("index.aspx");
}
请帮小弟看看这段asp.net中的代码,我点登录按钮时总是提示“from子句错误”,
人气:111 ℃ 时间:2020-05-09 08:20:37
解答
string sql = "select * from [user] where [user_name]='" +t1.Text.Trim()+ "' and [user_password]='"+t2.Text.Trim()+ "'";
推荐
猜你喜欢