Results page problems

S

STU

Jim, thanks for all the help. This is working to some
extent. When i do a search from my form field
called "companyname" for the company Alltel it pulls up
the first record it finds with the company name of Alltel
and creates the next button, the link looks like this:

https://in.northern-tech.com/quote/nwiebe/companyname.asp?
companyname=alltel

Where is falls apart is when you hit the next button. It
doesn't take you to the next record with Alltel in the
company name field, it just takes you to another record
and the link changes accordingly:

https://in.northern-tech.com/quote/nwiebe/companyname.asp?
recnr=2

Here is how the asp code looks:

<%
companyname = Request.QueryString( "companyname")

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ=mypath\mydatabase.mdb"

Const adOpenKeySet = 1
Const adLockReadOnly = 1
Const adUseClient = 3

sql = "SELECT * FROM Results WHERE company LIKE '%"&
companyname &"%'"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = adUseClient
rs.Open sql, Conn, adOpenKeySet, adLockReadOnly

if isnumeric(request.querystring("recnr")) then
recnr = cint(request.querystring("recnr"))
if recnr < 1 then
recnr = 1
end if
if recnr > rs.recordcount then
recnr = rs.recordcount
end if
else
recnr = 1
end if

if recnr > 1 then
rs.move(recnr - 1)
end if

if recnr > 1 then
response.write "<a href=""?recnr=" & recnr - 1 & """>" &
_
"Back</a>"
end if

if recnr < rs.recordcount then
response.write "<a href=""?recnr=" & recnr + 1 & """>" &
_
"Next</a>"

end if

if rs.eof then
Response.write("No records found.")
Response.End
end if


%>

How can i make it keep looking for all records with the
same that name i searched for?
 
Top