Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Perl & ADORecordsets

by Solo (Deacon)
on Sep 13, 2006 at 20:52 UTC ( #572816=note: print w/replies, xml ) Need Help??


in reply to Perl & ADORecordsets

In general, you want to thoroughly read the Win32::OLE documentation. The Roth books also have useful info for this type of Perl on Win32 work.

Here is code I've used in the past to get you started, YMMV with newer versions of ADO.

use Win32 qw( in ); my $ConnStr = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Se +curity Info=False;Data Source=server;Initial Catalog=database;"; my $AdoConn = new Win32::OLE("ADODB.Connection"); $AdoConn->Open($ConnStr); my $AdoRs = new Win32::OLE("ADODB.Recordset"); my $sql = "select * from table"; $AdoRs->Open($sql, $AdoConn); ROW: while (!$AdoRs->{EOF}) { my @col; for my $field ( in $AdoRs->Fields ) { push @col, $field->{Value}; } # ... } continue { $AdoRs->MoveNext(); } $AdoRs->Close();

--Solo

--
You said you wanted to be around when I made a mistake; well, this could be it, sweetheart.

Replies are listed 'Best First'.
Re^2: Perl & ADORecordsets
by merrymonk (Hermit) on Sep 14, 2006 at 07:09 UTC
    Many thanks for the information sources and the
    'starter' code.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://572816]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (1)
As of 2021-08-05 00:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My primary motivation for participating at PerlMonks is: (Choices in context)








    Results (44 votes). Check out past polls.

    Notices?