Loading Combobox from SQL
I trying to load a combobox and I am having a few problems, here is my code:
VB Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Dim MM_DB_STRING
MM_DB_STRING = "Provider=SQLOLEDB;Data Source=(Local);" _
& "Initial Catalog=IADATA;User Id=UserName;Password=Password;"
Dim customerRS
Dim customerRS_numRows
Dim Customer
Set customerRS = Server.CreateObject("ADODB.Recordset")
customerRS.ActiveConnection = MM_DB_STRING
customerRS.Source = "select USERLNAM, P_WORD from CURRENT_Users"
customerRS.CursorType = 0
customerRS.CursorLocation = 2
customerRS.LockType = 1
customerRS.Open()
customerRS_numRows = 0
%>
<%
While (NOT customerRS.EOF)
%>
<%
Customer =(customerRS.Fields.Item("USERLNAM").Value)%><%=(customerRS.Fields.Item("USERLNAM").Value)%>
<%
customerRS.MoveNext()
Wend
If (customerRS.CursorType > 0) Then
customerRS.MoveFirst
Else
customerRS.Requery
End If
%>
<%
customerRS.Close()
Set customerRS = Nothing
%>
And the actionscript
my_lv = new LoadVars();
my_lv.onLoad = handleLoad;
my_lv.load("combobox.asp");
function handleLoad(success) {
if(success) {
for(var i in this) _root.customer.addItem(i,this[i]);
} else {
trace("Problems loading combo data!");
}
}
Any suggestions?
Thanks