(note: i'm going to assume that trailing "Vinyl powder free gloves" is a copy/paste error)
what does $db2->Error() say?
Taking a closer look at your debugging, you have:
$db2->Sql($sql2)|| die("Query error");
Reading the docs for
Win32::ODBC, it says that
->Sql() "Returns ? on success, or an error number on failure." .. apparently (after looking at the source) they meant s/\?/undef/ ... BUT you have that '||' in there, so on _success_ it's going to die. You need to change it to something like:
my $rc = $db2->Sql($sql2);
die sprintf("Query error!! RC: %s ; Error: %s ; SQL: %s", $rc, $db2-
+>Error(), $sql2) if $rc;
As i mentioned above, DBI/DBD is far superior for this because of placeholders... and
radiantmatrix below was kind enough to post a sample porting of your code -- be sure to review it...
Update: oops .. forgot the "if $rc" on there ... and changed $Sql->Error() to $db2->Error()
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.