我有一個非常簡單的查詢,只返回一條記錄。當我嘗試從唯一記錄中的唯一列中獲取值時,我會得到「BOF或EOF爲True,或者當前記錄已被刪除。請求的操作需要當前記錄。」這裏發生了什麼?如果RecordCount爲0,導致錯誤的代碼甚至不會執行,並且我已驗證記錄集確實包含記錄。爲什麼recordset.RecordCount等於1但recordset.EOF和recordset.BOF都等於True
代碼如下。嘗試設置strDN時引發錯誤。它很簡單,但我無法弄清楚我要去哪裏錯了。
編輯,包括COMMAND
<LDAP://DC=something,DC=com>;(&(objectCategory=person)(objectClass=user)(!userAccountControl:1.2.840.113556.1.4.803:=2)(employeeID=));distinguishedName;subtree
Set adoRecordset = adoCommand.Execute
If adoRecordset.RecordCount > 0 Then
strDN = adoRecordset.Fields("distinguishedName").Value
Set objUser = GetObject("LDAP://" & strDN)
objGroup.add(objUser.ADsPath)
End if
我編輯了我的問題。該命令包含在上面的代碼中。 – res 2010-06-29 18:36:38