Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old May 21st, 2004, 05:19 PM
dinchak dinchak is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 1 dinchak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question "type mismatch" in recordset value

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!

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > "type mismatch" in recordset value


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway