| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi everyone, I'm having trouble displaying the results of an Active Directory query. I keep getting a "Type Mismatch" error whenever I try to access the value of a recordset field. This is how I'm querying the Active Directory:
--- Set oConn = CreateObject("ADODB.Connection") Set oCommand = CreateObject("ADODB.Command") Set oRS = CreateObject("ADODB.Recordset") oConn.Provider = "ADsDSOObject" oConn.Properties("ADSI Flag") = 1 oConn.Properties("User ID") = "domain\username" oConn.Properties("Password") = "secret" oConn.Open "Active Directory Provider" Set oCommand.ActiveConnection = oConn strQuery= "<LDAP://myadserver.domain.net>;(cn=*);cn;subtree" oCommand.CommandText = strQuery oCommand.Properties("Page Size") = 99 Set oRS = oCommand.Execute While not oRS.EOF For Each oFld In oRS.Fields Response.Write "Name: " & oFld.Name & " / Value: " & oFld.Value Next oRS.MoveNext Wend --- The bold/italicized line is where the error is generated. If I remove the "& oFld.Value" then it displays ~50 lines of "Name: cn", so I believe it's correctly querying the Active Directory, however I can't seem to do anything with oFld.Value. I've tried casting it to a string, Dim-ing it, using the oRS.fields("cn") syntax, and always get the "Type Mismatch" error. The strange thing is that this code works fine on one IIS server but not on another. I was wondering if anybody has ever seen this behavior and knows how to fix it? I believe the code is fine, but some configuration setting in the IIS server is incorrect, or libraries are out of date, not installed, etc. Any suggestions would be greatly appreciated! Thank you! |
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > "type mismatch" in recordset value |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|