Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble with Stored Procedure

Status
Not open for further replies.

JaySang

Technical User
Jun 26, 2003
43
CA
I don't think i'm doing this right because my result is -1

I'm trying to launch a simple stored procedure, that doesn't require any input, and just display the results.

Heres the code
Code:
use DBI;
use DBD::ODBC;
my $server = "ServerName";
my $db = "DBName";
my $username = "xxxxxx";
my $password = "xxxxxxx";

my $dbh = DBI->connect("DBI:ODBC:$server","$username","$password") or die;
$dbh->do("use $db");
$query = ("exec dbo.GetMenuDBExport");

my $sth = $dbh->prepare($query);
my ($test) = $sth->execute() or die ("Can't Execute" . $sth->errstr());

print $test;

Thanks
 
Problem Solved.

A few problems with the code above
Code:
$query = ("exec dbo.GetMenuDBExport");
Doesn't require the exec to launch the stored procedure.

Code:
my ($test) = $sth->execute() or die ("Can't Execute" . $sth->errstr());
This line is ajust all wrong. I used a while with fetchrow_array()


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top