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;
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;