Hello all.  I have a general dbi question.  In the past, I've done
something like this:

my $sql = "select id, sku, description from widgets";
my $gw = $dbh->prepare($sql)
$gw->execute;
While (my $r = $gw->fetchrow_hashref){
        my $sql = "select sum(available) from inventory where
widget_id=$$r{id}";
        my $ga = $dbh->prepare($sql);
        $ga->execute;
        $$r{available} = $ga->fetchrow_hashref;
        $ga->finish;
        push(@widgets, $r); # for an HTML::Template loop
}
$gw->finish;

I was doing this using DBI ADO on a machine that had sql-server and IIS
installed, and it worked just fine.  But now I'm running the script on a
different box than the sql-server, and I get the error:  "Cannot create
new connection because in manual or distributed transaction mode."

This seems to be a result of trying to execute a second command while
the first is open.  If I separate them out, it works fine.

I'm just wondering, is it terrible to use the above method when I can
get away with it, portability issues aside?  Should I be hanging my head
in shame for having lived this way so long?  What are some other issues?



_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to