Refresh failed : 0 records found error

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
kneighbour
Posts: 77
Joined: Wed 08 Oct 2008 04:55

Refresh failed : 0 records found error

Post by kneighbour » Thu 16 Nov 2017 01:44

I am using UniDac 7.1.4 in Delphi XE7 and with Firebird 3.0.2. Just recently I have been getting this "Refresh failed : 0 records found" error when I am doing a post on a UniDac table. It is a very hard thing to diagnose as it is not all the time.

One scenario where it occurs is -
Open table
Perform an external Update query to update a value in the table. ie in another module and using an "UPDATE...." script.
Put table in Edit mode
Post table.
You will get the error.

The fix I found is
Open table

.... you must close table
close table
Perform the external Update query to update values in the table
open table
...carry on
Put table in Edit mode
Post table.
No error

This kind of makes sense. You may have edited the currently open record in the local table. Mind you, it never did this on earlier versions - or perhaps FB 3 is being a problem? And the error message does not seem to reflect what is going on.

Anyway - this is not the only time this error occurs. I have researched this a bit on Google and not much help there. There is a primary key on the table. One thing - the table is a detail table in a Master-Detail relationship.

Here is another scenario
Open table
Add record, Post - no problem
Edit record. Post - you get the error.

You can edit another record - no worries. Then after that you can come back and edit the original record. No problems.

100% of the time. I am still trying to work out the problem in this scenario. Any tips appreciated!

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

Re: Refresh failed : 0 records found error

Post by ViktorV » Thu 16 Nov 2017 09:25

The 'Refresh 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.
You can set the TUniTable.Options.StrictUpdate property to False to avoid the 'Refresh failed. Found X records' error. See more details about this property in UniDAC help: https://www.devart.com/unidac/docs/?dev ... update.htm

Post Reply