Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Posts
    23

    Unanswered: update not updating

    I am trying to update some rows in my DB2 db using ODBC, I am not getting any error but the update is not successful. I am using PERL language.


    $connect='agftemp'; #DSN

    if(!($dbh = new Win32::ODBC($connect))) {
    print "Error Connecting to $connect\n";
    die("Error:" .Win32::ODBC::Error(). "\n");
    }

    $cmd2 = "UPDATE ITEM_LNE set QTY_USED = $qty_used where ORDER_NO=$ordernum and LINE_NO=$line_no";

    $dbh-> sql(cmd2);

    Plase let me know what to change in above script.

    The same update query (shown below) works fine without any problem if I make the connection but it is very slow


    my $dbh_ITEM = DBI->connect("DBI:XBase:/agftemp") or die "XBASE DBD CUST COULD NOT BE OPENED.\n";

    my $sth_QTY_USED = $dbh_ITEM->prepare("UPDATE ITEM_LNE set QTY_USED = $qty_used where ORDER_NO=$ordernum and LINE_NO=$line_no")or die "UPDATE QUERY COULD NOT BE PREPARED FOR ITEM_LNE.DBF QTY_USED.\n";

    $sth_QTY_USED->execute();




    Is someone who can help me with the script mentioned on top. r if you can please let me know some online documentation about PERL::ODBC::win32?

    Thanks

    ANurag

  2. #2
    Join Date
    Jan 2004
    Location
    Germany
    Posts
    167

    Re: update not updating

    $dbh-> sql(cmd2);
    I think it has to be changed to $dbh->sql($cmd2); !

    And
    Code:
    $dbh->do($cmd2);
    is faster than
    Code:
    $dbh->prepare($cmd2); 
    $dbh->execute();

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •