Hello Monks
I have a problem. I seem to be doing everything correct, but my info is not getting into the database. IF you notice, I put an error tracking statement print $dbh->errstr right before the executtion takes place. I tried to put this statement after the execute statemtn but it didn't execute. So the error i get is this "DBI::db=HASH(0x2305378)->errstr"
Any Ideas?? Thanks
use DBI;
#database parameters
my ( $data_source, $database, $user_id, $password ) =qw ( servername d
+omain username password );
my $conn_string = "driver={SQL Server}; Server=$data_source; Database=
+$database; UID=$user_id; PWD=$password";
#Connect the database handle.
my $dbh = DBI->connect("DBI:ODBC:$conn_string") or die "$DBI::errstr\n
+";
$insertSQL = <<'EndOfSQL';
INSERT INTO delivery
(customerNo,salesOrderNo,sequenceNo,incrementNo,requestDate,quantity,d
+eliveryDate,externalNotes,shipVia)
VALUES(?,?,?,?,?,?,?,?,?)
EndOfSQL
my $insertHandle = $dbh->prepare($insertSQL) or die "Problem creat
+ing inserting handle: ", $dbh->errstr;
########### show error ##########
print "$dbh->errstr";
$insertHandle->execute('customerNo',
'salesOrderNo',
'sequenceNo',
'none',
'dateD',
'quantityD',
'dateD',
'none',
'companyD')
or die "Problem Inserting: ", $dbh->errstr;
#EndofSQL
# Execute the query
$SQL->execute() || die "Couldn't execute statement: $DBI::errstr\n";
$rowCount = $SQL->commit();
$dbh->disconnect();
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.