I have a simple script
use Win32::ODBC; $dsn="DSN=web;UID=**;PWD=*****;database=Ecommerce"; $dsn2="DSN=web;UID=**;PWD=*****;database=Ecommerce"; $db = new Win32::ODBC($dsn); $db2 = new Win32::ODBC($dsn2); if (not defined $db2) { print "error connecting to data source \"$dsn\"\n"; print '('.Win32::ODBC::Error.")\n"; exit; } $sql ="SELECT * FROM category"; $db ->Sql($sql); while ($db->FetchRow()) { my(%data) = $db->DataHash(); $sql2="update category set chrCat_Full_Name='".ucfirst(lc($data{'ch +rCat_Full_Name'}))."' where chrCategory_Code='".$data{'chrCategory_Co +de'}."'"; $db2->Sql($sql2)|| die("Query error"); print "$sql2 $data{'chrCat_Full_Name'}\n"; } $db->Close; $db2->Close;
and when i run this code i get msg query error. I've checked field names 100 times and its all correct. Can someone tell me why the sql2 query doesnt work ?

2005-08-30 Retitled by Arunbear, as per Monastery guidelines
Original title: 'Query error'


In reply to Win32::ODBC query error by nicpon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.