#!/Perl
# from : http://aspn.activestate.com/ASPN/docs/ActivePerl/5.8/faq/Windows/ActivePerl-Winfaq12.html

### NOT FUNCTIONAL - see autoax01.pl for a functional example, provided the MDB has been
### created with autoaccess01.pl .......................................................

### In order to use ActiveX Data Objects (ADO) you can just
use strict;
use Win32::OLE;
use Win32::OLE::Const 'Microsoft ActiveX Data Objects';

my $Conn = Win32::OLE->new('ADODB.Connection'); # creates a connection object
my $RS = Win32::OLE->new('ADODB.Recordset');    # creates a recordset object

$Conn->Open('DBname');                          # opens the database connection

my $Fields = ['Id', 'Name', 'Phone'];
my $Values = [1, 'Joe Doe', '555-1234'];

if (Win32::OLE->LastError()) {
	print "This didn't go well: ", Win32::OLE->LastError(), "\n";
} else {
	$RS->AddNew($Fields, $Values);                  # adds a record
	print "Done ...\n";
}

$RS->Close;
$Conn->Close;

# eof - autoado01.pl

