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( "defaultNamingC ontext")
strOU = "OU=Generic Accounts,"
' Use ADO to search Active Directory.
Set objCommand = CreateObject("A DODB.Command")
Set objConnection = CreateObject("A DODB.Connection ")
objConnection.P rovider = "ADsDSOObje ct"
objConnection.O pen "Active Directory Provider"
objCommand.Acti veConnection = objConnection
strBase = "<LDAP://" & strOU &" " & strDNSDomain &">"
strFilter = "(&(objectCateg ory=person)(obj ectClass=user)) "
strQuery = strBase & ";" & strFilter & ";cn;subtre e"
objCommand.Comm andText = strQuery
objCommand.Prop erties("Page Size") = 100
objCommand.Prop erties("Timeout ") = 30
objCommand.Prop erties("Cache Results") = False
Set objRecordSet = objCommand.Exec ute
objRecordSet.Mo veFirst
Do Until objRecordSet.EO F
sName = objRecordSet.Fi elds("cn").Valu e
'Response.Write (sName)
genericAccount = "<option value= & '"sName"' & >"
objRecordSet.Mo veNext
Loop
%>
<html><head><ti tle>Dynamic Drop-Down Menu Example</title></head>
<body>
<form method="POST" action="test3.a sp">
<p><select size="1" name="GenericAc counts">
<%=genericAccou nt%>
</select></p>
</form>
</body>
</html>
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( "defaultNamingC ontext")
strOU = "OU=Generic Accounts,"
' Use ADO to search Active Directory.
Set objCommand = CreateObject("A DODB.Command")
Set objConnection = CreateObject("A DODB.Connection ")
objConnection.P rovider = "ADsDSOObje ct"
objConnection.O pen "Active Directory Provider"
objCommand.Acti veConnection = objConnection
strBase = "<LDAP://" & strOU &" " & strDNSDomain &">"
strFilter = "(&(objectCateg ory=person)(obj ectClass=user)) "
strQuery = strBase & ";" & strFilter & ";cn;subtre e"
objCommand.Comm andText = strQuery
objCommand.Prop erties("Page Size") = 100
objCommand.Prop erties("Timeout ") = 30
objCommand.Prop erties("Cache Results") = False
Set objRecordSet = objCommand.Exec ute
objRecordSet.Mo veFirst
Do Until objRecordSet.EO F
sName = objRecordSet.Fi elds("cn").Valu e
'Response.Write (sName)
genericAccount = "<option value= & '"sName"' & >"
objRecordSet.Mo veNext
Loop
%>
<html><head><ti tle>Dynamic Drop-Down Menu Example</title></head>
<body>
<form method="POST" action="test3.a sp">
<p><select size="1" name="GenericAc counts">
<%=genericAccou nt%>
</select></p>
</form>
</body>
</html>
Comment