我做了一个查询..在本机上用无论什么时候都可以用..
传上空间后...有时候竟然出现错误.空间那里屏蔽掉出错的原因.没能看到出错原因..一般出错的时候是网页开得比较久了没有去点击什么的..如果涮新一下就会好..我是把sqls.aspx文件用iframe 到静态页面里去的
sqls.aspx
<%@ Page Language="VB" debug="true" %>
<%@ import namespace="system.data" %>
<%@ import namespace="system.data.OleDb" %>
<script runat="server">
dim thetit as string
sub page_load(sender as object, e as eventargs)
sq.Attributes.Add("onkeydown","SubmitKeyClick('button1');")
end sub
Sub sq_click(sender as object,e as eventargs)
Application("title")=sq.text
Response.Redirect("sql.aspx")
sq.text=""
end sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<link href="css/my.css" rel="stylesheet" type="text/css">
</head>
<body>
<form runat="server" target="_blank">
<SCRIPT LANGUAGE="javascript">
function SubmitKeyClick(button)
{
if (event.keyCode == 13)
{
event.keyCode=9;
event.returnValue = false;
document.all[button].click();
}
}
</SCRIPT>
<table width="114" height="164" border="0" cellpadding="0" cellspacing="0">
<tr>
<td background="images/1.gif"><table width="114" height="148" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><div align="center" class="acc">【研究报告查询】</div></td>
</tr>
<tr>
<td><div align="center">请输入您要找的报告关键词进行查询</div></td>
</tr>
<tr>
<td align="center"><asp:TextBox BorderColor="#000000" BorderStyle="solid" BorderWidth="1" ID="sq" runat="server" Width="80" ></asp:TextBox></td>
</tr>
<tr>
<td align="center"><asp:Button ID="button1" runat="server" Text="查询" OnClick="sq_click" BorderStyle="solid" BorderWidth="1" BorderColor="#000000"></asp:Button></td>
</tr>
</table></td>
</tr>
</table>
</form>
</body>
</html>
sql.aspx
<%@ Page Language="VB" debug="true" %>
<%@ import namespace="system.data"%>
<%@ import namespace="system.data.OleDb" %>
<script runat="server">
dim thetit as string
sub page_load(sender as object, e as eventargs)
if not IsPostBack then
DataBind()
end if
end sub
sub DataBind()
if Application("title")<>"" then
thetit=Application("title").ToString()
dim cnn as OleDbConnection
dim cmd as OleDbDataAdapter
dim dt as new DataSet
dim strcnn, sql as string
strcnn="provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("./database/query.mdb")
cnn=new OleDbConnection(strcnn)
cnn.open()
sql="select * from query where title like '%" & trim(thetit) & "%'"
cmd=new OleDbDataAdapter(sql,cnn)
cmd.fill(dt)
repeater1.Datasource=dt
repeater1.dataBind()
cnn.close()
Application.Remove("title")
else
ta1.text="没有找到任何结果"
end if
end sub
</script>
<html>
<body>
<asp:repeater id="repeater1" runat="server">
<itemtemplate>
<table>
<tr>
<td height="28" >
<div class="acss"><a href="/<%# Container.DataItem("links") %>" target="_blank" />
<%# Container.DataItem("title") %></div></td>
</tr>
</table>
</itemtemplate>
</asp:repeater>
</body>
</html>