JamesNC has asked for the wisdom of the Perl Monks concerning the following question:
DBD::ODBC::st execute failed: [Microsoft][ODBC SQL Server Driver]Inval +id cursor state (SQL-24000)(DB D: dbd_describe/SQLNumResultCols err=-1) at H:\progs\dbi_test.pl line +10.
If you move the PRINT statement AFTER the select statement, you don't get the error, but you also don't see the output of the print.#c:/perl/bin/perl use DBI; my $dbh = DBI->connect( 'dbi:ODBC:TEST_DSN', '','', {RaiseError=> 1} ) +; my $sth = $dbh->prepare( "PRINT '...begin' select name = 'test' " ); my $rv = $sth->execute(); print "rv: $rv \n"; while ( my $hr = $sth->fetchrow_hashref ){ print $$hr{$_}, "\n" for ( keys %$hr ); print "Err: ", $dbh->errstr, "\n" if $dbh->errstr; }
|
---|