我想点击按钮进入下一个页面,代码如下:
protected void Button1_Click(object sender, EventArgs e)
{
string UserName = name.Text.Trim();
string PassWord = pwd.Text.Trim();
OleDbDataAdapter da = new OleDbDataAdapter("select * from Admin where admin='" + UserName + "' and password='" + PassWord + "'", my_conn);
DataTable ds = new DataTable();
da.Fill(ds);
if(ds.Rows.Count>0)
{
Response.Write ("<script>location.href=('main.aspx');</script>");
}
}
但点击按钮后没反应,怎么进入不了main.aspx页面?
protected void Button1_Click(object sender, EventArgs e)
{
string UserName = name.Text.Trim();
string PassWord = pwd.Text.Trim();
OleDbDataAdapter da = new OleDbDataAdapter("select * from Admin where admin='" + UserName + "' and password='" + PassWord + "'", my_conn);
DataTable ds = new DataTable();
da.Fill(ds);
if(ds.Rows.Count>0)
{
Response.Write ("<script>location.href=('main.aspx');</script>");
}
}
但点击按钮后没反应,怎么进入不了main.aspx页面?
首先看这句执行过没。如果没有执行,就换别的跳转办法,如window.open();
Response.Redirect("main.aspx");
我晕啊。你的write和括号中间有空格啊。