Hi,
I'm using Tk and OLE to try and get information from an MS Access database ... here is my code...
#
# Summary..
#
# Connect to Access db, perform SQL search
# Print values to a listbox 'widget'
#
my $conn = CreateObject OLE "ADODB.Connection";
my $sql = "SELECT PNPartNumber,PNTitle FROM PN
WHERE PNPartNumber = '$string'";
my $rs = $conn->Execute($sql);
while ( $rs->{EOF} )
{
$return = $rs->Fields(PNPartNumber)->Value." ".$rs->Fields(PNTitle);
$listbox_widget->insert('end',$return);
push (@store, $rs->Fields(PNPartNumber)->Value, $rs->Fields(PNTitle)->Value);
$rs->MoveNext;
}
$rs->Close();
Now on running this section of code I get the following error ...
Tk::Error: Can't call method "Close" on unblessed reference
(command bound to event)
(The event is a <RETURN> key bind from an entry box)
If I remove all Tk code and run as a simple DOS application then I can query the db OK...
Hopefully this is enough information so does anyone have any hints on where I am going wrong or what I could test to resolve?
Thanks,
SP
I'm using Tk and OLE to try and get information from an MS Access database ... here is my code...
#
# Summary..
#
# Connect to Access db, perform SQL search
# Print values to a listbox 'widget'
#
my $conn = CreateObject OLE "ADODB.Connection";
my $sql = "SELECT PNPartNumber,PNTitle FROM PN
WHERE PNPartNumber = '$string'";
my $rs = $conn->Execute($sql);
while ( $rs->{EOF} )
{
$return = $rs->Fields(PNPartNumber)->Value." ".$rs->Fields(PNTitle);
$listbox_widget->insert('end',$return);
push (@store, $rs->Fields(PNPartNumber)->Value, $rs->Fields(PNTitle)->Value);
$rs->MoveNext;
}
$rs->Close();
Now on running this section of code I get the following error ...
Tk::Error: Can't call method "Close" on unblessed reference
(command bound to event)
(The event is a <RETURN> key bind from an entry box)
If I remove all Tk code and run as a simple DOS application then I can query the db OK...
Hopefully this is enough information so does anyone have any hints on where I am going wrong or what I could test to resolve?
Thanks,
SP