Accessing Pervasive.SQL With Perl

Page Last Modified:

Home Links ODBC (DBI) Contact

DBI + ODBC - Update Example

use strict;
use warnings;
use DBI;

eval {
print "Connecting to database...\n";
my $dbHandle = DBI->connect('dbi:ODBC:DEMODATA', '', '', {PrintError=>0,RaiseError=>1});

print "Preparing statement...\n";
my $stHandle = $dbHandle->prepare("UPDATE Course SET Credit_Hours = 2 WHERE Name = 'PERL01'");

print "Running update...\n";
my $ret = $stHandle->execute();
print "$ret row(s) updated...\n";

print "Disconnecting...\n";
or do {
print "Error: $DBI::err - $DBI::errstr\n";

print "Finished\n";

Home Links ODBC (DBI) Contact

All content on this site is copyright
Neil Hughes 2010 - 2018