if($dbh = DBI->connect($connectionInfo,$userid,$passwd)){ $sth = $dbh->prepare($query); if($sth->execute()){ @dsetcols=[]; $xi=0; @fieldnames = split(/,/, $fnames); foreach $fieldname (@fieldnames) { $ds{$dsetname}{$fieldname}=[]; push @dsetcols,""; $sth->bind_col($xi+1,\$dsetcols[$xi]); if ($fieldname eq "task_id") { } $xi++; } while($sth->fetch()) { $xi=0; foreach $fieldname (@fieldnames) { push @{$ds{$dsetname}{$fieldname}},safedecode($dsetcols[$xi]); $xi++; } } $sth->finish(); }else{ print "Query \""; print $query; print "\" failed.
"; print "Database error message: "; print $dbh->errstr; print "

"; # used in do_autorefresh, detail window won't automatically close if query failed $badquery = 1; } $dbh->disconnect; }else{print "Could not connect to database.
";} } $x++; } #### IF (@max_vendor != (SELECT vendor_id FROM Inserted)) BEGIN RAISERROR ('PO already exists with a different vendor',16,1) ROLLBACK TRAN END