Guest_imported
New member
- Jan 1, 1970
- 0
I'm totally, totally new at this ADO/ASP stuff. Does anyone have any idea as to why my dropdown isn't populating? The variables txtAddr and txtZip come from text boxes in a form on the previous page. I'd appreciate in help in layman's terms. Thanks!!!! Here is my code:
<%
'Declaration of Variables
Dim cnnSearch ' ADO connection
Dim rs ' ADO Recordset
Dim strDBPath ' path to Access database (*.mdb) file
Dim strSQL ' The SQL Query built on the fly
Dim strSearchAddr ' The House Number being looked for
Dim strSearchZip ' The Zip Code being looked for
strSearchAddr = Request.Form("txtaddr"
strSearchZip = Request.Form("txtzip"
%>
<HTML>
<HEAD>
<TITLE>Polling Places</TITLE>
</HEAD>
<BODY bgcolor="white" text="black">
<br><br>
<font face="arial" size="5">
To help you locate the correct Polling Place based on the Address and Zip Code of your place of residence, I need to know your address and zip code.
Please select your address from the drop down lists below.</font>
<center>
<table width="98%">
<tr><td>
<%
If strSearchAddr <> "" AND strSearchZip <> "" Then
strDBPath ="c:\Inetpub\
Set cnnSearch = Server.CreateObject("ADODB.Connection"
cnnSearch.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=vote"
' Build query based on the input.
strSQL = "SELECT PRP_ADDR, PRP_ZIP, POLLING, POLL_ADDR, POLL_CITY, LOCATION " _
& "FROM POLLING_PLACES " _
& "WHERE PRP_ADDR LIKE '" & Replace(strSearchAddr, "'", "''"
& "%' " _
& "AND PRP_ZIP LIKE '" & Replace(strSearchZip, "'", "''"
& "' " _
& "ORDER BY PRP_ZIP;"
Set rstSearch = cnnSearch.Execute(strSQL)
%>
<form action="GetPlace.asp" method="post">
<select name="AddrDown">
<% 'Loop through the recordset, creating a list item for each.%>
<% do while not rstSearch.eof%>
<Option Value="<%= rstSearch.Fields("PRP_ADDR"
.Value %>">
</Option>
<%rstSearch.movenext
loop%>
</select>
<br><center><input type="submit" value=Submit></center>
</form>
</td></tr>
</table>
<p>
</center>
<%
' Close our recordset and connection and dispose of the objects
rstSearch.Close
Set rstSearch = Nothing
cnnSearch.Close
Set cnnSearch = Nothing
End If
%>
</BODY>
</HTML>![[sadeyes] [sadeyes] [sadeyes]](/data/assets/smilies/sadeyes.gif)
<%
'Declaration of Variables
Dim cnnSearch ' ADO connection
Dim rs ' ADO Recordset
Dim strDBPath ' path to Access database (*.mdb) file
Dim strSQL ' The SQL Query built on the fly
Dim strSearchAddr ' The House Number being looked for
Dim strSearchZip ' The Zip Code being looked for
strSearchAddr = Request.Form("txtaddr"
strSearchZip = Request.Form("txtzip"
%>
<HTML>
<HEAD>
<TITLE>Polling Places</TITLE>
</HEAD>
<BODY bgcolor="white" text="black">
<br><br>
<font face="arial" size="5">
To help you locate the correct Polling Place based on the Address and Zip Code of your place of residence, I need to know your address and zip code.
Please select your address from the drop down lists below.</font>
<center>
<table width="98%">
<tr><td>
<%
If strSearchAddr <> "" AND strSearchZip <> "" Then
strDBPath ="c:\Inetpub\
Set cnnSearch = Server.CreateObject("ADODB.Connection"
cnnSearch.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=vote"
' Build query based on the input.
strSQL = "SELECT PRP_ADDR, PRP_ZIP, POLLING, POLL_ADDR, POLL_CITY, LOCATION " _
& "FROM POLLING_PLACES " _
& "WHERE PRP_ADDR LIKE '" & Replace(strSearchAddr, "'", "''"
& "AND PRP_ZIP LIKE '" & Replace(strSearchZip, "'", "''"
& "ORDER BY PRP_ZIP;"
Set rstSearch = cnnSearch.Execute(strSQL)
%>
<form action="GetPlace.asp" method="post">
<select name="AddrDown">
<% 'Loop through the recordset, creating a list item for each.%>
<% do while not rstSearch.eof%>
<Option Value="<%= rstSearch.Fields("PRP_ADDR"
</Option>
<%rstSearch.movenext
loop%>
</select>
<br><center><input type="submit" value=Submit></center>
</form>
</td></tr>
</table>
<p>
</center>
<%
' Close our recordset and connection and dispose of the objects
rstSearch.Close
Set rstSearch = Nothing
cnnSearch.Close
Set cnnSearch = Nothing
End If
%>
</BODY>
</HTML>
![[sadeyes] [sadeyes] [sadeyes]](/data/assets/smilies/sadeyes.gif)