这是 search-process.asp 文件,我有一个带有搜索框的主页,该搜索框链接到该文件并使用搜索词来搜索我的数据库。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>UNIBOOK - Your facebook alternative - but with no adverts..!</title>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/unibookStyle.css" />
<%@ Language=VBScript %>
<%
set conx=server.CreateObject("adodb.connection")
conx.Provider="Microsoft.ACE.OLEDB.12.0"
conx.Open Server.Mappath("db/unibookv2.mdb")
set userRs=server.CreateObject("adodb.recordset")
userRs.Open "SELECT * FROM ubuser WHERE usr_firstname LIKE '%" & request("searchinput") & "%' OR usr_lastname LIKE '%" & request("searchinput") & "%' ORDER BY '%" & request("orderlist") & "%' ",conx, adOpenkeyset, AdLockOptimistic
%>
<!-- #include FILE="include/header.asp") -->
<div id="container"><!-- start container -->
<h2>USER DATABASE</h2>
<!-- start of dynamic html page -->
<h2>ASP Search Results ordered by : <%=request("orderlist")%></h2>
<%="<b>Search string:</b> " & searchinput & "<br />"%>
<hr align="left" width="658" />
<%if NOT userRs.EOF Then%>
<!-- start of html table -->
<table border="0" width="758" cellspacing="0" cellpadding="3">
<!-- create the first (heading) row in standard HTML -->
<tr class="tableheading">
<td><b>Usr_id</b></td><td><b>firstname</b></td><td> <b>lastname</b></td><td> </td>
<td><b>Usr_id</b></td><td><b>firstname</b></td><td> <b>lastname</b></td><td> </td>
</tr>
<% counter=0 %>
<%Do While Not userRs.EOF
counter=counter+1
if ((counter mod 2)= 1) Then%>
<tr>
<td>
<%=userRs("usr_id") & " "%>
</td>
<td>
<%=userRs("usr_firstname") %>
</td>
<td>
<%=userRs("usr_lastname") %>
</td>
<%else%>
<td>
<!-- display the name of the mountain -->
<%=userRs("usr_id") & " "%>
</td>
<td>
<!-- some comment here -->
<%=userRs("usr_firstname") %>
</td>
<td>
<%=userRs("usr_lastname") %>
</td>
</tr>
<%end if%>
<%userRs.MoveNext
LOOP%>
</table>
<%else%>
<!-- remember to provide a message if the search is not successful -->
<h3>Sorry your search was unsuccessful, please retry</h3>
<%end if%>
<p> </p>
<hr align="left" width="658">
<input type="button" value="< Back to Search Page" OnClick="top.location='default.asp'">
<!-- #include FILE="include/sidebar.asp") -->
</div><!-- end main page content -->
<%
' tidy up any ASP objects used to free web server resources...
userRs.close
set userRs=nothing
set conx=nothing
%>
<!-- #include FILE="include/footer.asp") -->
</body>
</html>
我收到此错误,不确定是 SQL 还是 ASP
ADODB.Recordset error '800a0bb9' 参数类型错误、超出可接受范围或相互冲突。
/student/s0190204/part2/search-process.asp,第 17 行