Hello!
First, please excuse my bad english, i hope you will understand the following text:
I have got a Live Dataset, that meens
ReadOnly := false;
The primary Key of the selected Table is not in the Statement, f.e.:
SELECT BlobField FROM Table WHERE pkey=123
The blobfield will be edited with a DBMemo Component.
The Update will fail, because of primary key is missing.
This Error occurs: Update failed. Found 2234 records.
2234 is the record count of the Table. All Records will be edited!
How can i prevent such a error. It's ok, if the component will bring an error, but this reaction destroys the data of my customer.
The problem is, that this appication is an ex BDE program. With the BDE it was no problem to miss the primary key. Now I can't measure if there any other statements with this error. So I want to prevent this in my Database components.
Please help me.
Thanks a lot.
Update failed. Found 2234 records.
To solve the problem you should use SQLUpdate property to specify the SQL statement that will be used when applying an update to a dataset, like this:
Code: Select all
IBCQuery.SQLUpdate.Text := 'UPDATE Table SET BlobField = :BlobField WHERE pkey=123';
Thank you for your answer.
The main problem is, that such code is in innumerable places in the code. It's an Application with more than 1200 Classes.
I always use a derivation of TIBCQuery ->
I am searching for a solution, that prevents the update in this cases.
There can be a program error, but the data of the customer may not be destroyed.
In the BDE TQuery there was a property UpdateMode which you can set to upWhereKeyOnly.
Is there any comparable in TIBCQuery?
The main problem is, that such code is in innumerable places in the code. It's an Application with more than 1200 Classes.
I always use a derivation of TIBCQuery ->
Code: Select all
TMyIBCQuery = class(TIBCQuery)
There can be a program error, but the data of the customer may not be destroyed.
In the BDE TQuery there was a property UpdateMode which you can set to upWhereKeyOnly.
Is there any comparable in TIBCQuery?
IBDAC doesn't support the UpdateMode property.
The point is that TIBCQuery for the updating records tries to execute the query which includes only one blob field entered in SQL statement. To avoid this problem, you should use SELECT query with key fields or set the SQLUpdate property, like this:
The point is that TIBCQuery for the updating records tries to execute the query which includes only one blob field entered in SQL statement. To avoid this problem, you should use SELECT query with key fields or set the SQLUpdate property, like this:
Code: Select all
SELECT pkey, BlobField FROM Table WHERE pkey=123