Board index » delphi » Updates affect more than one record error.

Updates affect more than one record error.


2005-09-14 06:56:55 AM
delphi103
Following the article "Building Applications with ClientdataSet and Interbase express" I have the following structure:
DBGRID>SOURCE>CLIENTDATASET>PROVIDER>IBQUERY>DATABASE.
Can read the database, display data in the DBGRID, all OK.
When I execute the CLIENTDATASET "ApplyUpdates(0)" statement to hopefully write changed records to the database I get the following message:
"EDataBaseError Update affected more than 1 record"
Everything I have read in the help files and articles such as I have quoted above indicate that the "ApplyUpdates" will move ALL modified records from the client data set to the provider and the database.
Any help/suggestions/whatever appreciated.
Ian
 
 

Re:Updates affect more than one record error.

Check the SQL being generated. More than likely you need to set the TFields
pfInKey for the key fields or remove the InWhere flag. Once you see the SQL you
should be able to determine how the SQL is wrong and updating more than a single
record. you can see the SQL by either a) turning on the SQL Monitor flags and
setup a SQL monitor or b) put a breakpoint in PSExecuteStatement (IIRC) in
IBCustomDataset and look at what is being sent to IBX.
You should use the dedicated IBX groups for IBX questions. Usually this will
result in faster answers.
--
Jeff Overcash (TeamB) On waves of silver I dreamed of gold
(Please do not email 'Till I lost the peace that dreaming gives
me directly unless I dreamed of the moment of my own death
asked. Thank You) That no one ever dreams and lives (Marillion)
 

Re:Updates affect more than one record error.

"Jeff Overcash (TeamB)" <XXXX@XXXXX.COM>writes:
Quote
Check the SQL being generated. More than likely you need to set the TFields
pfInKey for the key fields or remove the InWhere flag. Once you see the SQL you
should be able to determine how the SQL is wrong and updating more than a single
record. you can see the SQL by either a) turning on the SQL Monitor flags and
setup a SQL monitor or b) put a breakpoint in PSExecuteStatement (IIRC) in
IBCustomDataset and look at what is being sent to IBX.

You should use the dedicated IBX groups for IBX questions. Usually this will
result in faster answers.

--
Jeff Overcash (TeamB) On waves of silver I dreamed of gold
(Please do not email 'Till I lost the peace that dreaming gives
me directly unless I dreamed of the moment of my own death
asked. Thank You) That no one ever dreams and lives (Marillion)
Thanks for the suggestions. Using the monitor is not good as the program carshes/throws an exception before the relevant SQL appears to get to the monitor. With regards to a beakpoint within IBClientDataSet how do I recompile it with debug code without having to update the vcl70 package, etc??
Any directions appreciated, Ian.
 

Re:Updates affect more than one record error.

Ian Upton writes:
Quote

Thanks for the suggestions. Using the monitor is not good as the program carshes/throws an exception before the relevant SQL appears to get to the monitor. With regards to a beakpoint within IBClientDataSet how do I recompile it with debug code without having to update the vcl70 package, etc??
You can not debug into the packages. Just build without runtime packages. The
debug DCU's are already available in Delphi. Also if you are using
ibxpress70.bpl you are using an old version of IBX. Go to CodeCentral and get
the latest version. In later versions the SQL is sent out to the monitor before
the exception IIRC.
Quote

Any directions appreciated, Ian.
--
Jeff Overcash (TeamB) On waves of silver I dreamed of gold
(Please do not email 'Till I lost the peace that dreaming gives
me directly unless I dreamed of the moment of my own death
asked. Thank You) That no one ever dreams and lives (Marillion)