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?

In reply to MS SQL problem by Win

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.