Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to pass a ADO object reference to sub

2 views
Skip to first unread message

j3...@my-deja.com

unread,
Nov 29, 2000, 3:00:00 AM11/29/00
to
I would like to pass a reference to an ADODB.Connection object to a Perl
subroutine but I am having trouble casting the reference as an
ADODB.Connection. Calling the sub like this (where $Conn is a valid ado
connection) generates the error:

"Can't call method "Errors" without a package or object reference on
line..."


eval{ AdoError($Conn)};

$Response->Write($@) if $@;

exit;

sub AdoError(\$)
{
#modified from 'ActivePerl with ASP and ADO' by Tobias Martinsson

my $conn = @_;

if($conn->Errors->{Count})
{
my $errOutput;

foreach my $error (Win32::OLE::in($conn->Errors)) {
foreach my $property (keys %{$error}) {
$errOutput.=$property.": ";
$errOutput.=${$error}{$property};
$errOutput.="<BR>";
}
}

die $errOutput;

}

}


Sent via Deja.com http://www.deja.com/
Before you buy.

0 new messages