my $dbh = DBI->connect("dbi:driver:database",
"user","password",
{RaiseError=>1, PrintError=>0})
or die "can't connect ($DBI::errstr)\n";
my $sth;
eval {
$sth = $dbh->prepare( $sql );
$sth->execute;
};
if ($@) {
print "There was an error ($DBI::errstr)\n";
# do something appropriate
}
####
my $sql = "INSERT INTO t1 (lsname) VALUES ( ? )";
my $sth;
eval {
$sth = $dbh->prepare( $sql );
$sth->execute ($lsname);
};
if ($@) {
print "There was an error ($DBI::errstr)\n";
# do something appropriate
}
##
##
_ _ _ _
(_|| | |(_|><
_|