Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Empty Drop-Down box from Record Set 2

Status
Not open for further replies.

TonyU

Technical User
Feb 14, 2001
1,317
US
I can't find the error on my code. I'm trying to fill a drop-down box from an Access DB but it's not working. Thanks in advance.


Here's my code:
<%
Dim RSvedit
set RSvedit=server.createobject(&quot;adodb.recordset&quot;)
RSvedit.open &quot;vendors&quot; &quot;dsn=db1&quot;
RSvedit.MoveFirst
%>

<%
<form method=&quot;post&quot; action=&quot;--WEBBOT-SELF--&quot;>
<p align=&quot;center&quot;><select size=&quot;1&quot; name=&quot;vendorsdrop&quot;>
<option selected value=&quot;Select Vendor&quot;>Select Vendor</option>
<%
Do while NOT RSvedit.EOF
Response.Write &quot;<Option Value='&quot; & RSvedit1(&quot;accnumber&quot;) & &quot;'>&quot;
Response.Write RSvedit(&quot;accnumber&quot;) & &quot;</Option>&quot;
RSvedit.MoveNext
Loop
RSvedit.Close
set RSvedit=nothing
%>
</select></p>
<p align=&quot;center&quot;><input type=&quot;submit&quot; value=&quot;Submit&quot; name=&quot;B1&quot;>  
<input type=&quot;reset&quot; value=&quot;Reset&quot; name=&quot;B2&quot;></p>
</form>
%>

I don't see it, I'm sure you will. Thanks again.






Only if I really helped you
|
|
|
|
V (-:
 
This is what ic TonyU
Whatever you see in RED was missing from your syntax, I don't c anything else wrong.

<%
Dim RSvedit
set RSvedit=server.createobject(&quot;adodb.recordset&quot;)
RSvedit.open &quot;vendors&quot;, &quot;dsn=db1&quot;
RSvedit.MoveFirst
%>

<%
<form method=&quot;post&quot; action=&quot;--WEBBOT-SELF--&quot;>
<p align=&quot;center&quot;><select size=&quot;1&quot; name=&quot;vendorsdrop&quot;>
<option selected value=&quot;Select Vendor&quot;>Select Vendor</option>
<%
Do while NOT RSvedit.EOF
Response.Write &quot;<Option Value='&quot; & RSvedit1(&quot;accnumber&quot;) & &quot;'>&quot;
Response.Write RSvedit(&quot;accnumber&quot;) & &quot;</Option>&quot;
RSvedit.MoveNext
Loop
RSvedit.Close
set RSvedit=nothing
%>
</select></p>
<p align=&quot;center&quot;><input type=&quot;submit&quot; value=&quot;Submit&quot; name=&quot;B1&quot;>
<input type=&quot;reset&quot; value=&quot;Reset&quot; name=&quot;B2&quot;></p>
</form>
%>
QUOTE OF THE DAY
Not to know if bad; not to wish to know is worse.
<%
Jr Clown
%>
 
Thanks, that was it. Only if I really helped you
|
|
|
|
V (-:
 
hmm

you should try this

select a query from the database, i assume it's vendor is the table you use...
<%

set cnn = Server.CreateObject(&quot;ADODB.Connection&quot;) clientlist = &quot;SELECT * FROM Vendors&quot; set Results = cnn.Execute(clientlist)
Response.Write(&quot;<SELECT class='box1' name=vendorlist>&quot;)
do until Results.eof
Response.Write(&quot;<OPTION value='&quot; & Results(&quot;accnumber&quot;) & &quot;>&quot; & Results(&quot;accnumber&quot;))
Results.movenext loop
Response.Write(&quot;</SELECT>&quot;)
cnn.Close %>

This way is a lot easier than that garble of code...

hope this helps,

hui
 
my way is much more efficent...:)

sql makes it lot better..

since it executes the transaction and then closes the connection.

hui
 
Thanks bro, I will keep your suggestion in mind. Only if I really helped you
|
|
|
|
V (-:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top