WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Database Discussion Forum This is the place to find help resolving those nagging questions you have about implementing and using all kinds of databases. Need help writing a query? Need an opinion on Oracle? Post here!

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-19-2003, 03:49 PM
WebProWorld New Member
 

Join Date: Jul 2003
Posts: 23
Cecile hoffman RepRank 0
Default I need help asap with asp!!!

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
%>
Reply With Quote
  #2 (permalink)  
Old 12-19-2003, 08:19 PM
WebProWorld New Member
 

Join Date: Dec 2003
Location: chanhassen MN
Posts: 23
cerami2 RepRank 0
Default try this

i use a extention for ultradev i bought online called The Dynamic Search SQL by thomas muck this will save you alot of time

http://www.basic-ultradev.com/exthelp/dynsearch/
__________________
Joe Cerami 11
1640 lake drive west
Chanhassen MN 55317
http://barbaramorrison.com
http://wwsrecords.com
http://surplusrecords.com
http://cannonballdistributing.com
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum
Tags: , ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0