use strict;
use Win32::OLE;
use Win32::OLE::Const 'Microsoft ActiveX Data Objects';
# Change these three variables
my $database = "TestAccess.mdb";
my $table = "Clients";
my $field1 = "CompanyName";
my $field2 = "ClientID";
my $field3 = "Phone";
my $Conn = Win32::OLE->new("ADODB.Connection");
my $RS = Win32::OLE->new("ADODB.Recordset");
my $DSN = "PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver (*.mdb)};
DBQ=$database;UID=;PWD=;";
$Conn->Open($DSN);
my $SQL = "SELECT $field1, $field2, $field3 FROM $table";
$RS->Open($SQL, $Conn, 1, 1);
until ($RS->EOF) {
my $value1 = $RS->Fields($field1)->value;
my $value2 = $RS->Fields($field2)->value;
my $value3 = $RS->Fields($field3)->value;
print $value1,"\t",$value2,"\t",$value3,"\n";
$RS->MoveNext;
}
$RS->Close;
$Conn->Close;
Hi All,
Please go through the above code, If i execute the same code with tables and columns having whitespace characters in their names. I am getting the following error (Can't call method "value" on an undefined value). Please help.... Kindly suggest me the solution for this particular scenario.
Thanks & Regards,
Srikant