this produces the message that the adodb.recordset object could not be created
Here is the code..
Code: Select all
;/////////////////////////////////////////////////////////////////////////////////
;***COMate*** COM automation through iDispatch.
;*===========
;*
;*ADO demo. Based on a PureDispHelper example by Kiffi.
;*Create and read a MDB database.
;/////////////////////////////////////////////////////////////////////////////////
XIncludeFile "adoconstants.pbi"
IncludePath "..\..\"
XIncludeFile "COMatePLUS.pbi"
OpenConsole()
#ADS_CHASE_REFERRALS_EXTERNAL = 40;//parseInt('40',16);
;
; // Create connection object
; var _conn = new ActiveXObject("ADODB.Connection")
;
; // Create command object
; var _com = new ActiveXObject("ADODB.Command");
;
; // Prepare connection object For use
; _conn.Provider = "ADsDSOObject";
; _conn.Open("Active Directory Provider");
;
; // Prepare command object For use
; _com.ActiveConnection = _conn;
; _com.Properties("Page Size") = 100;
; _com.Properties("Timeout") = 60;
; _com.Properties("Searchscope") = 2;
; _com.Properties("Cache Results") = false; // Do not cache the result set.
; _com.Properties("Chase referrals") = ADS_CHASE_REFERRALS_EXTERNAL;
Define.COMateObject adoConnection, adoRecordSet,adoCommand,ocomm2
;Create a new MDB database.
;==========================
connectionString$ = "Active Directory Provider"
adoConnection = COMate_CreateObject("ADODB.Connection")
adoCommand = COMate_CreateObject("ADODB.Command")
adoRecordSet = COMate_CreateObject("ADODB.RecordSet")
If adoConnection
adoConnection\SetProperty("Provider = 'ADsDSOObject'")
If adoConnection\Invoke("Open('" + connectionString$ + "')") = #S_OK
;Insert some records.
;Note that since the SQL statement is to contain single quotes (which will interfere with COMate), we must use
;the $0027 escape sequence instead.
SQL$ = "<LDAP://dc=domain1,dc=domain2,dc=domainSuffix>;(&(objectClass=user)(cn=*));cn,dn,adsPath;subtree"
If COMate_GetLastErrorCode() = #S_OK
adoCommand\SetProperty("ActiveConnection = " + Str(adoConnection) + " as COMateObject")
;put command options
;_com.Properties("Searchscope") = 2;
adoCommand\SetProperty("CommandText = '" + SQL$ + "'")
;sqlCheck$ = adoCommand\GetStringProperty("CommandText")
adoRecordSet = adoCommand\GetObjectProperty("Execute()")
err$ = COMate_GetLastErrorDescription()
If adoRecordSet
rcount = adoRecordSet\GetIntegerProperty("RecordCount")
Debug(rcount)
Repeat
EOF = adoRecordSet\GetIntegerProperty("EOF")
If EOF = -1 ;Variant_TRUE
Debug("bullshit")
Break
EndIf
cn$ = adoRecordSet\GetStringProperty("Fields('cn')\Value")
dn$ = adoRecordSet\GetStringProperty("Fields('dn')\Value")
adsPath$ = adoRecordSet\GetStringProperty("Fields('adsPath')\Value")
PrintN("Darrick is: ")
PrintN(#TAB$ + cn$)
PrintN(#TAB$ + dn$)
PrintN(#TAB$ + adsPath$)
adoRecordSet\Invoke("MoveNext")
ForEver
adoRecordSet\Invoke("Close")
adoRecordSet\Release()
Else
PrintN("Couldn't create the recordset object!")
EndIf
Else
PrintN("There was a problem adding the records!")
EndIf
Else
PrintN("Couldn't create open the connection!")
EndIf
adoConnection\Invoke("Close")
adoConnection\Release()
Else
MessageRequester("COMate - ADO demo", "Couldn't create a connection object!")
EndIf