in reply to Connection to a MSSQL Database
use constant DATA => 'driver=Microsoft Access Driver (*.mdb); +dbq=data.mdb'; my $db_connection = new Win32::OLE('ADODB.Connection'); my $rs = new Win32::OLE("ADODB.Recordset"); # Connect to the database and tie the recordset object to # the database. $db_connection->Open(DATA); # Set the connection doohickey # $rs->CursorLocation(adUseClient); my $sql = "select c.info from MYTABLE as c;"; $rs->Open($sql, $db_connection, adOpenKeySet); if($rs->BOF()) { return; } my $data = $rs->getrows(); return unless defined($data->[0][0]); return $data->[0][0];
|
---|