I hope this is the right group. I am very new to ASP so this is
probably a stupid question. I have some vbscript that query's AD and
populates a recordset. I know the recorset contains the information I
want by doing a Response.write. I am having problems dynamically
creating a drop down list from the data in the recordset. The drop down
is created but it is empty. Any help would be greatly appreciated. A
sample of the code:
<%
'On Error Resume Next
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
strOU = "OU=Generic Accounts,"
' Use ADO to search Active Directory.
Set objCommand = CreateObject("ADODB.Command")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
objCommand.ActiveConnection = objConnection
strBase = "<LDAP://" & strOU &" " & strDNSDomain &">"
strFilter = "(&(objectCategory=person)(objectClass=user))"
strQuery = strBase & ";" & strFilter & ";cn;subtree"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 100
objCommand.Properties("Timeout") = 30
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
sName = objRecordSet.Fields("cn").Value
'Response.Write(sName)
genericAccount = "<option value= & '"sName"' & >"
objRecordSet.MoveNext
Loop
%>
<html><head><title>Dynamic Drop-Down Menu Example</title></head>
<body>
<form method="POST" action="test3.asp">
<p><select size="1" name="GenericAccounts">
<%=genericAccount%>
</select></p>
</form>
</body>
</html>