JavaScript population of ASP drop down

P

philip.morgan

First, my apologies for a newbie question that may have been answered
before - my JavaScript skills lag behind my VB experience.

I am trying to populate an drop down control with the recordset
results of an ADODB connection to a Access DB. The database/recordset
portion seems to be working fine. However, I'm not clear how to write
the Select <options>.

BACKGROUND
* I have modularized the DB open + close.... global var the
variables

function openDB() {
strConnection = "UID=;pwd=;DSN=reports;";
objConn = new ActiveXObject("ADODB.Connection");
objConn.open(strConnection);
objRS = new ActiveXObject("ADODB.Recordset");
}
function closeDB() {
objRS.Close();
objConn.Close();
}

* The onChange even triggers the following:
openDB();
strSqlData ="SELECT fld_example from tbl_example";
objRS.open(strSqlData, objConn);
while(!objRS.EOF) {
........ OK so far....how do I get the recordset
sequentially into the select?
<OPTION value="<%= rs("fld_example")%>"><%=
rs.Fields("fld_example")%></option>
<%
rs.movenext
Loop
%>
....??? VB how do wite that into the form using JS?

Any advice or examples would be greatly appreciated (other than RTFM).

Phil Morgan






// document.getElementById("year").[getElementById("year").length]=
new Option ("display string " + i, "value " + i);
// }
closeDB();
break;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top