Dear Monks,
Has anyone had experience of the following error message:
DBD::ODBC::st execute failed: [Microsoft][ODBC SQL Server Driver]Conne
+ction is busy with results for another hstmt (SQL-HY000)(DBD:st_execu
+te/SQLExecute err=-1) at 20_October_2004_K.pl line 209, <FLAT_FILE> l
+ine 29.
I get it when running the following bit of code. It is a problem that I did not have earlier. But now I am activating this code in a different way.
sub Got_Command {
my($Command,$Request_id, $outputfile) = @_;
print "Hi_F\n";
print "here\n";
# my $output_file = "Output/Output_file_".$Request_id.".txt";
open (OUTPUT_FILE, ">$outputfile");
print "$Command\n";
my $sthB_A = $dbh->prepare($Command) or die "Couldn't prepare query
+: ".$dbh->errstr;
$sthB_A->execute() or die "Couldn't execute query: ".$sthB_A->errstr
+;
my $Return_results = "Select * from Result_storage_keep where Unique
+_identifier = ".$Request_id." AND Aggregated_area = Instance_name AND
+ Disease_cat = Cause_catagory\;";
print "$Return_results";
print "$Return_results\n";
my $sth_C = $dbh->prepare($Return_results) or die "Couldn't prepare
+query: ".$dbh->errstr;
$sth_C->execute() or die "Couldn't execute query: ".$sth_C->errstr;
####The problem shows up here
while (my @row = $sth_C->fetchrow_array ) {
print OUTPUT_FILE join("\t", @row);
print OUTPUT_FILE "\n";
}
}
Can anyone please suggest improvements to this code?