[ic] SQL Query in UserTag
Ben Mirecki
interchange-users@lists.akopia.com
Mon May 14 10:14:01 2001
Hi!
I'm trying to create a UserTag that does a field value lookup from an
arbitrary table. The UserTag will be called from CommonAdjust as part of the
pricing method.
Here's the code I have.
UserTag calc_price Order
UserTag calc_price Routine <<EOR
sub {
my $dbh = $Sql{framestyles};
my $sql_query = "SELECT price FROM framestyles WHERE sku = 9848";
my $sth = $dbh->prepare($sql_query) or return error_message("Error...");
my $rc = $sth->execute() or return HTML("Error...");
return 0;
}
EOR
Ignore the return value for now. Simply trying to execute the query, I get
the following error message:
Runtime error: Can't call method "prepare" on an undefined value at (eval
227) line 5.
Any idea why is this happening?
Thanks,
Ben