Hello Richard,

Am 17.08.2025 um 18:03 schrieb Richard Schoen <richard@xxxxxxxxxxxxxxxxx>:

A .Net desktop app that runs on multiple PCs is inserting new records.

The inserts always work just fine so there’s no issue there.

But on some of the machines we’re getting a -1 instead of 1 for the returned value after the ExecuteNonQuery operation to insert records. (The return code stands for records affected/modified.)

Reading the ODBC docs say that all operations other than INSERT, UPDATE, DELETE can return a -1 for success, but the CRUD options should always return records affected/modified.

Only thing I can think so far is the PCs possibly have different versions of the IBM Access ODBC Driver on them and that older versions of the ODBC driver didn’t send back records affected correctly.

Any other thoughts or ideas are appreciated.

I have no definitive answer for you, but I know from my own experience that I never had a connection working to ODBC specs, returning the number of affected rows. I even found that the return value isn't even helpful to detect errors!

Not with V4R5 and the iseriesaccess Linux 7.1.0 driver package, nor with 7.2, 7.3 and the most recent iACS driver package.

However, because I'm most often not interested in the number of affected rows, but if an error happened, I found checking if the database handle yields an error.

This is how I do this in Perl:

if ( defined($dbh->errstr) ) {
printf("SQL error: %s", $dbh->errstr);
die;
}

$dbh is the database handle I get with DBI->connect() in Perl.

Hope that helps a bit!

:wq! PoC



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.