Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: ODBC and OLE DB

by b0dh1 (Initiate)
on May 25, 2000 at 20:20 UTC ( #14794=note: print w/ replies, xml ) Need Help??


in reply to ODBC and OLE DB

Yes, I'm using the Win32::OLE mod. Using the Win32::ODBC mod I've been unable to open a recordset that I can iterate through. I can open a connection for executing SQL statements, but I can't open a recordset (guess I just don't know the commands for creating the recordset object)

With the data transfer, I'm just going textfile-to-DB, but I'm looping through the recordset before each SQL INSERT statement to make sure I'm not inserting duplicate data.


Comment on Re: ODBC and OLE DB
RE: Re: ODBC and OLE DB
by KM (Priest) on May 25, 2000 at 20:39 UTC
    Well, as I mentioned you are trying to execute the SQL with a method that doesn't exist in Win32::ODBC. Refer to my last response (or the docs for Win32::ODBC) for the correct method. Below is a quick example of using Win32::ODBC:

    use Win32::ODBC; my $DSN = qq(DSN Name); my $db; if (!($db = new Win32::ODBC($DSN))){ print "Connection Error: " . Win32::ODBC::Error . "\n"; exit; } my $qry = qq(select * from table); if ($db->Sql($qry)){ print "SQL Error: " . $db->Error . "\n"; $db->Close; exit; } while($db->FetchRow){ my %record = $db->DataHash; print $record{FIELD}; ... etc ... } $db->Close;

    Again, read the docs that come with Win32::ODBC, and visit roth.net for more documentation.

    Cheers,
    KM

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2015-07-05 08:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (61 votes), past polls