I use the ADO-Components free available from
http://http://www.microsoft.com/data/ado/ .
As DB-Provider I use ActiveDirectory insteed
an classic SQL-DB.
I belive the problem is, that Python do not know
the COM-Type of "adoRec" in attached programm-
snips.
First, what I get from Python:
PythonWin 2.1 (#15, Apr 23 2001, 18:00:35) [MSC 32 bit (Intel)] on win32.
Portions Copyright 1994-2001 Mark Hammond ([EMAIL PROTECTED]) - see
'Help/About PythonWin' for further copyright information.
>>> from win32com.client import Dispatch
>>> adoCon = Dispatch("ADODB.Connection")
>>> adoCon.Provider = "ADSDSOObject"
>>> adoCon.Open("", "cn=Administrator;cn=Users,dc=strebig,dc=de",
"AdminsPW")
>>> adoCon.State
1
>>> adoRec =
>adoCon.Execute("<LDAP://dc=strebig,dc=de>;(objectClass=User);Name,ADsPath;SubTree")
>>> adoRec
(<COMObject Execute>, -1)
>>> adoRec.EOF
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
AttributeError: 'tuple' object has no attribute 'EOF'
>>> adoRec.Fields
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
AttributeError: 'tuple' object has no attribute 'Fields'
>>>
//Now, what I excpect (JScript + WSH):
adoCon = new ActiveXObject("ADODB.Connection");
adoCon.Provider = "ADSDSOObject";
adoCon.Open("", "cn=Administrator;cn=Users,dc=strebig,dc=de", "AdminsPW");
WScript.Echo(adoCon.State); // 1
adoRec =
adoCon.Execute("<LDAP://dc=strebig,dc=de>;(objectClass=User);Name,ADsPath;SubTree");
WScript.Echo(adoRec.EOF); // 0 == false
while(!adoRec.EOF)
{ WScript.Echo(adoRec.Fields.Item("ADsPath").Value); // Administrator, User1, User2...
adoRec.MoveNext();
}
Every help is welcome.
--
Markus Daniel <mailto: [EMAIL PROTECTED]>
Telephone +49 174 175 20 21
PGP-Key 0x3f3cb98d
_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activepython