Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: ASP List Boxes


Message #1 by tekconsult42@h... on Mon, 14 Aug 2000 23:34:13
Hi,



I'm working on a dynamic form where I want to insert data from the form 

into my db and then pass the info from several list boxes on a single form 

to another page. The list boxes are populated with the following code (this 

one is for 'country'):



<%

Dim objDB

Dim objRS

Dim sDBName

'all on one line

sDBName = "driver={Microsoft Access Driver 

(*.mdb)};dbq=D:\mbo\common\data\mydb.mdb"



'db-connection

Set objDB = Server.CreateObject("ADODB.Connection")

objDB.Open sDBName



Set objRS = objDB.Execute("select * from [CountryList] order by 

[Country]")



'displays the list box in the html form

Response.Write("<select name=""CountryID"">")

Do While Not objRS.EOF

	Response.Write("<option value=" & Chr(34) & objRS("CountryID") & Chr(34) & 

">" & objRS("Country"))

	objRS.MoveNext

Loop



Response.Write("</select>")

%>



This part is working fine.  I'm using a simple link to my database, such as 

<%=fname%> for 'first name', which works fine in the textbox fields, but 

not for the select object here.  What's the best approach?



Thanks,



Melvin Hendrix


  Return to Index