ASP Drop down menu

J.B

J.B

Soldato
Joined
16 Aug 2006
Posts
5,924
Hey guys, I was hoping someone could help me, Im not great at this ASP or SQL thing but i know the basics.

What I would like is a drop down menu <select> where the <option>'s are generated from a field in the database. I've got the connection to the db, just cant work out the actual select and options part of the form.

Thanks
 
not having much luck with that, where abouts would i put it in the code, sorry for being an idiot!
 
Sure thing, I've kinda got it working a different way:

Code:
strSQL = "strSQL = "SELECT * FROM tbManu"
	
	adoRec.Open strSQL, adoCon, adOpenStatic, adLockOptimistic, adCmdText
	adoCon.Execute strSQL

	dbRecordCount = adoRec.RecordCount
	for ix= 1 to dbRecordCount

	response.write("<SELECT>")
	response.write("<option>")&	(adoRec.fields("Manufacturer"))
	response.write("</option>")
	
	
	adoRec.movenext
	next
	response.write("</SELECT>")"

Basicly the table contains car manufacturers and I need this in a drop down box
 
Changed it ever so slightly to this:

Code:
	for ix= 1 to dbRecordCount

	response.write("<SELECT>")
	response.write("<option value=""")& (adoRec.fields("Manufacturer"))& """ >" & (adoRec.fields("Manufacturer"))
	response.write("</option>")

adoRec.movenext
	next
	response.write("</SELECT>")

It works sort of. I have one drop down box with the first option but then instead of having it populated with the options they are written as strings after the combo box. Im guessing its something to do with the for loop
 
Back
Top Bottom