我的代码如下,在复制代码之前我写了问题,当我查询时,它在代码提及中显示 pincode 作为查询,有时显示未找到,现在它显示空白没有结果,即使查询没有错误,我认为问题是当我查询数据时,指针位于上次查询的记录位置,但不再刷新内存并转到数据库或程序的启动,任何人都可以帮助我摆脱
代码在 asp 中查询 mS 访问 mdb 2003
<html>
<body>
<div id ="pin">
<%
city= Request.Form("username")
area = Request.Form("password")
Dim Conn,rs,strSQL
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open"Provider= Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/pinner/db/database1.mdb")
'Conn.Open"DRIVER=Microsoft Access Driver(*.mdb);DBQ=" & Server.MapPath("/pinner/db/Database1.mdb")
'strSQL = "SELECT pincodes.officename FROM pincodes where pincode = '" & city & "';"
Set rs = Server.CreateObject("ADODB.Recordset")
strSQL = "Select pincode from pincodes WHERE Districtname = '" & city & "' AND officename = '" & area & "';"
'strSQL = "Select pincode from pincodes WHERE (Districtname like "&city& *" AND officename like "&area&*");"
rs.Open strSQL,Conn
If rs.EOF or rs.BOF Then
Response.Write ("<br>")
Response.Write ("[pincode] not found")
Response.Write ("<br>")
Else
Response.Write ("<br>")
Response.Write (rs("pincode"))
Response.Write ("<br>")
End If
rs.close
Conn.close
Set rs = Nothing
Set Conn = Nothing
%>
</div>
</body>
</html>