[Tutor] ADO problem

János Juhász janos.juhasz at VELUX.com
Mon Jul 16 23:24:37 CEST 2007


Hi Tim,

thanks your help.
It is clear for me now.

> From: Tim Golden <mail at timgolden.me.uk>
> Subject: Re: [Tutor] ADO problem

> J?nos Juh?sz wrote:
> > while not rs.EOF:
> >     print rs.Fields[0].Value, rs.Fields[1].Value
> >     rs.MoveNext()
> >
> > It print the next result:
> > IT (u'\xc1kos Szab\xf3',)
> > IT (u'Szabolcs K\xe1m\xe1n',)
> > ...
> >
> > So rs.Fields[1] is a tuple.

> Well, here's the most obvious thing:

> By the look of it: rs.Fields[1] is *not* a tuple.
> It's an instance of some sort. rs.Fields[1].Value
> *is* a tuple. So something like this:

> rs.Fields[1].Value[0]

> should work. I'm not quite clear why that second
> field returns a tuple while the first one doesn't.

Yes, It works.

So, I have to use
rs.Fields[1].Value[0] 
instead of
rs.Fields[1][0].Value


> To do this specific thing, you might find it easier
> to use a module wrapper:

> http://tgolden.sc.sabren.com/python/active_directory.html

> where your query would become something like (untested):

Your module works perfectly.
You should know something about the recordsets :)

> <code>
> import active_directory

> for user in active_directory.search (
> objectClass="User",
> name="*.ferbeau",
> department="IT"
> ):
> print user.name, user.description, user.department
> 
> </code>

Regards,
Janos


More information about the Tutor mailing list