Well, when you execute a command object, you get back a recordset object. Why not prep the RS object ahead of time, and use the command and connection objects after your leg work is done, like so:
use Win32::OLE 'in';
my $ADO = Win32::OLE->new("ADODB.Connection");
$ADO->{Provider} = "ADsDSOObject";
$ADO->Open("ADSI Provider");
my $ADOCmd=Win32::OLE->new("ADODB.Command");
$ADOCmd->{ActiveConnection}=$ADO;#new
$ADOCmd->{CommandText}="<$ADSPath>;(objectClass=User);samAccountNam
+e,HomeDirectory;SubTree";
my $ADOrs = Win32::OLE->new("ADODB.RecordSet");
$ADOrs->PageSize->{Value}=10000;
$ADOrs->Open({Source=>$ADOCmd,
ActiveConnection=>$ADO,})
until ($ADOrs->EOF){
my $homeDir=lc($ADOrs->Fields(1)->{Value});
if ($homeDir=~/^\\\\mf/){
my $account=lc($ADOrs->Fields(0)->{Value});
print OUT "$account\t$homeDir\n";
}
$ADOrs->MoveNext;
}
$ADOrs->Close;
$ADO->Close;
print "Wrote Accounts\n";
My thought is that in VB, you are lucky enough to be able to set the PageSize Property ahead of time, and on execution, the properties are applied when the object is returned. I've come to this (perhaps erroneous) conclusion because if you create the command object and then enumerate through the Command Properties before execution, you get back an empty set.
C-.
---
Flex the Geek
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|