Hi,
I am geting this error when i run the script. Please can anyone help me out.
"Can't call method "Fields" on unblessed reference at Text1.pl line 30."Success open
SCRIPT:#use strict;use Win32::OLE;
my($connstr,$strsql);$strsql="SELECT CleintName, ClientEmail From Emptable;"; #selects allnames the begin with s.
my $cn = Win32::OLE->new('ADODB.Connection'); # creates a cnection objectmy $rs = Win32::OLE->new('ADODB.Recordset'); # creates a recordset object#$connstr="Driver={MySQL};Server=myserver;Db=testdb;User=myuser;Password=secret";#MySQL$dbfile = 'C:\Documents and Settings\krishnanv\My Documents\db1.mdb';$connstr = "DRIVER={Microsoft Access Driver(*.mdb)};DBQ=$dbfile;UID=;PWD=;"; #MicrosoftAccess#$connstr="Driver={SQLServer};Server=myserver;database=testdb;UID=myuser;PWD=secret";#MS SQLServer
$cn->Open($connstr);if (Win32::OLE->LastError()){ print "This didn't go well: ", Win32::OLE->LastError(), "\n"; }else { print "Success open \n";}
$cn->{CommandTimeout}=0;$rs=$cn->execute($strsql);
while (!$rs->{EOF}) { #my($ename, $email)=($rs->Fields(0)->Value,$rs->Fields(1)->Value, $rs->Fields(2)->Value); $ename = $rs->Fields(ClientName)->Value; $email = $rs->Fields(ClientEmail)->Value; print "$ename\t\t$email\n"; $rs->MoveNext;}$cn->Close();
_______________________________________________
Perl-Win32-Database mailing list
Perl-Win32-Database@list...
To unsubscribe:
http://listserv.ActiveState.com/mailman/mysubs
opensubscriber is not affiliated with the authors of this message nor responsible for its content.