Hi All,
I have a search page that returns results from a sql server database. I would like the results to be similar to a listbox, allowing the user to select the result they want when multiple results are retuned and see the details in a seperate page. How can I allow the user to step through the results, select the item they want and open the detailed results in another window? Below is the code I am using to search the dataset and return the possible results. Thanks!
<%
Dim strURL
Dim strConnect
Dim rstSearch
Dim strDBPath
Dim strSQL
Dim strSearch
strURL = Request.ServerVariables("U
RL")
strSearch = Request.QueryString("searc
h")
%>
<p>Search by Parcel Number, Name or Address</p>
<form action="<%= strURL %>" method="get">
<input name="search" value="<%= strSearch %>" size="20" />
<input type="submit" />
</form>
<%
If strSearch <> "" Then
strDBPath = Server.MapPath("database.m
db")
Set strConnect = Server.CreateObject("ADODB
.Connectio
n")
strConnect.Open "Provider=SQLOLEDB; DRIVER=SQLServer; SERVER=na; UID=na; PWD=na; DATABASE=na;"
strSQL = "SELECT distinct last_name, first_name, parcel_number, py_tax_code, house_number, house_number_suffix, prefix_directional, street_name, street_suffix, post_directional, community_name, state, zip_code, gross_current_acres " _
& "FROM taxquerysystem " _
& "WHERE last_name LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
& "OR first_name LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
& "OR parcel_number LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
& "OR house_number + street_name LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
& "ORDER BY last_name;"
Set rstSearch = strConnect.Execute(strSQL)
%>
<table border="1" bordercolorlight="#AAAAAA"
bordercolordark="#919191">
<%
Do While Not rstSearch.EOF
%>
<tr>
<td><%= rstSearch.Fields("parcel_n
umber").Va
lue %> </td>
<td><%= rstSearch.Fields("first_na
me").Value
%> <%= rstSearch.Fields("last_nam
e").Value %></td>
<td><%= rstSearch.Fields("py_tax_c
ode").Valu
e %> </td>
<td><%= rstSearch.Fields("house_nu
mber").Val
ue %> <%= rstSearch.Fields("house_nu
mber_suffi
x").Value %> <%= rstSearch.Fields("prefix_d
irectional
").Value %> <%= rstSearch.Fields("street_n
ame").Valu
e %> <%= rstSearch.Fields("street_s
uffix").Va
lue %> <%= rstSearch.Fields("post_dir
ectional")
.Value %> <%= rstSearch.Fields("communit
y_name").V
alue %> <%= rstSearch.Fields("state").
Value %> <%= rstSearch.Fields("zip_code
").Value %></td>
<td><%= rstSearch.Fields("gross_cu
rrent_acre
s").Value %> </td>
</tr>
<%
rstSearch.MoveNext
Loop
%>
</table>
<%
rstSearch.Close
Set rstSearch = Nothing
strConnect.Close
Set strConnect = Nothing
End If
%>
</BODY>
</HTML>