Sub Login_Click(Sender As Object, E As EventArgs) dim Cnn as OleDbconnection dim cmd as OleDbcommand dim dataR as OleDbdataReader dim strcnn as string If Page.IsValid Then strcnn="provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../database/query.mdb") cnn=new OleDbconnection(strcnn) cmd=new OleDbcommand("select * from user_data where login_user='" & uname.text & "' and pwd='" & pwd.text & "'",cnn) cnn.open() datar=cmd.ExecuteReader() if (datar.Read()) then Session("login_user")=dataR("login_user").ToString() response.redirect ("admininfo.html") Else Response.Redirect("../index.aspx") end if End If End Sub
sub page_load(sender as object,e as eventargs) if session("login_user")="" then Response.Redirect("../index.aspx") end if
都是用session啊.. 查询那里是用 Sub sq_click(sender as object,e as eventargs) Application("title")=sq.text Response.Redirect("sql.aspx") sq.text="" end sub
public void DataBind() { string QurStr = Application["title"].ToString().Trim(); QurStr = QurStr.Replace(" ",""); string Ss = ""; int intLen = QurStr.Length; for (int i = 0; i < intLen; i++) { Ss += QurStr[i] + "%"; }
string sql = "select * from query where title like '%" + Ss + "'";