打开查询页面的话.一会不操作就会给个出错的界面
我没有配置web.cingif文件.但是在本机上和别的空间上都没有这个问题..
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 + "'";
OleDbConnection cnn = new OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("./database/query.mdb"));
OleDbDataAdapter cmd = new OleDbDataAdapter(sql, cnn);
DataSet dt = new DataSet();
cmd.Fill(dt,"query");
if (dt.Tables["query"].Rows.Count==0)
{
ta1.Text = "根据您输入的关键词无查询结果,请您输入尽量简洁的关键词进行查询";
ta2.Text = "比如“电力”、“医药”“汽车”“家具”等。";
}
else
{
DataGrid1.DataSource = dt;
DataGrid1.DataBind();
cnn.Close();
int count = dt.Tables["query"].Rows.Count;
la1.Text = (DataGrid1.CurrentPageIndex + 1).ToString();
la2.Text = DataGrid1.PageCount.ToString();
la3.Text = count.ToString();
}
}