I tried to print out the output of the select statement.  No error, but no printout either.  Not sure if there is an error in my code:
 
use Win32::ODBC;
my $pw = "password1";
my $user = "ted";
my $dsn = "db1";
$db = new Win32::ODBC("DSN=$dsn;UID=$user;PWD=$pw") || die "ERROR: Failed to open database $!\n" if(!$db);

my $sql="select count(*) from tblTicketFileProcessLog";
$db->Sql($sql);
 
if ($db->FetchRow())
{
    my @data = "">
}
else
{
    print "Query returned no results.\n";
}
print $data[0];


Peter Eisengrein <[EMAIL PROTECTED]> wrote:
 
 
 
What would be the code if i used Win32:ODBC?  The result of the select statement is a single value and not an array.  Appreciate your help, as I am new to using remote connections to a SQL database with Perl. 
 
 I have used it in a while loop and performed thousands of queries in the same session and have had no performance problems, although I'd believe the memory leak problem mentioned before.
 
 A similar call using Win32::ODBC would be:
 
 
my $dsn = "db_name";
$db = new Win32::ODBC("DSN=$dsn;UID=$user;PWD=$pw") || die "ERROR: Failed to open database $!\n" if(!$db);
 
my $sql="select count(*) from tblTicketFileProcessLog";
$db->Sql($sql);
 
if ($db->FetchRow())
{
    my @data = "">
}
else
{
    print "Query returned no results.\n";
}
 
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to