Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Perl & ADORecordsets

by Solo (Deacon)
on Sep 13, 2006 at 20:52 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-04-16 13:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found