Hi, I created a search page, search.asp for a website
http://www.patentlawbooks.com but I cannot make it work.
My database name is 'bookstore' my table name is 'table2'. It is a dsn less connection.
The code for the search page is :
Thank you so much if you can help me with this.
< %@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Dim rstSearch__criteria
rstSearch__criteria = "%"
If (Request ("select") <> "") Then
rstSearch__criteria = Request ("select")
End If
%>
<%
Dim rstSearch__textfield
rstSearch__textfield = "%"
If (Request ("textfield") <> "") Then
rstSearch__textfield = Request ("textfield")
End If
%>
<%
Const adOpenStatic = 3
Const adLockReadOnly = 1
Dim rstSearch
Set rstSearch = Server.CreateObject("ADODB.Recordset")
Set objConn = Server.CreateObject("ADODB.Connection")
strConnString = "DBQ=" & Server.MapPath("database/bookstore.mdb")
objConn.Open "Driver={Microsoft Access Driver (*.mdb)}; " &
strConnString
strSQL = "SELECT * FROM table2 WHERE '" +
Replace(rstSearch__criteria, "'", "''") + "'= '" + Replace(rstSearch__textfield, "'", "''") + "'"
rstSearch.Open strSql, objConn, adOpenStatic, adLockReadOnly
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<table width="750" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="181">Title</td>
<td width="205">Author</td>
<td width="148">ISBN</td>
<td width="216">ASIN</td>
</tr>
<tr>
<td height="21"><%=(rstSearch.Fields.Item("Title").Val ue)%></td>
<td><%=(rstSearch.Fields.Item("Author").Value)%> </td>
<td><%=(rstSearch.Fields.Item("ISBN").Value)%></td>
<td><%=(rstSearch.Fields.Item("ASIN").Value)%></td>
</tr>
</table>
</body>
</html>
<%
' Close Recordset
rstSearch.Close
Set rstSearch = Nothing
objConn.Close
Set objConn = Nothing
%>