“Update failed. Found 0 records” with pooling enabled

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
dupe
Posts: 21
Joined: Wed 15 Jun 2016 13:37

“Update failed. Found 0 records” with pooling enabled

Post by dupe » Fri 29 Jul 2016 10:38

Hello

We’ve migrated our application from ADO to SDAC.
The final step was to replace our own pooling to the SDAC functionality.
In the main application everything seems to work fine. But our automated tests aren’t working.
If we deactivate the pooling everything works, but not with pooling enabled.
At some point the exception “Update failed. Found 0 records” is thrown.
The StrictUpdate options is enabled and we'd like to keep it that way.
Our first assumption was the big amount of SQL Statements in these test’s, which will be executed in a small amount of time.
But we couldn’t find any indications.
It’s noteworthy that we updated the SDAC Source for our needs in terms of getting the actual id with IDENT_CURRENT.
We tried to set up a test project for you but it’s difficult because there are many dependencies on our own code.
Any suggestions would be appreciated because this problem gives us a headache.

Best regards

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: “Update failed. Found 0 records” with pooling enabled

Post by ViktorV » Fri 29 Jul 2016 11:48

The 'Update failed. Found 0 records' error occurs, because no record matched the WHERE condition.
Please analyze the SQL query, that is executed while calling Post. It can be seen using the dbMonitor tool. You can find out from the SQL query how many records match the WHERE condition.

dupe
Posts: 21
Joined: Wed 15 Jun 2016 13:37

Re: “Update failed. Found 0 records” with pooling enabled

Post by dupe » Fri 29 Jul 2016 13:27

The problem occurs only when pooling is set to true. If pooling is set to false everything works fine.
We assume that OLE DB will return a false RowsAffected value, if many small statements will be executed in a short time window.
And when we debug the execution of those statements and pause a little bit in between there is no error.
We wonder why this happens when pooling is set to true.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: “Update failed. Found 0 records” with pooling enabled

Post by ViktorV » Fri 29 Jul 2016 13:39

Unfortunately, we couldn't reproduce the issue. To ivestigate the issue, please compose a small sample reproducing the issue and send it to viktorv*devart*com , including scripts to create database objects.

dupe
Posts: 21
Joined: Wed 15 Jun 2016 13:37

Re: “Update failed. Found 0 records” with pooling enabled

Post by dupe » Mon 01 Aug 2016 10:25

We’ve found the problem!
One of our internal objects executed SQL Statements which were for the same batch on different connections.
In this SQL Batch NOCOUNT was set to ON but wasn’t disabled on the same connection.
Without pooling it wasn’t a problem because the connection was closed again.
But with pooling enabled the same connection was reused and so this option was still active.
We call Open on the connection of the Dataset so that the connection will not be returned to the pool.
However thank you for your help.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: “Update failed. Found 0 records” with pooling enabled

Post by ViktorV » Tue 02 Aug 2016 08:36

We are glad to know you have found a solution for the issue. Please contact us if you have any questions concerning SDAC.

Post Reply