Delphi DBGridEh editing, and then move up and down, the data will automatically post, such penalty for data collection of Modified judgment is false, how to solve this problem,
Because ADOquery Locktype set to ltBatchOptimistic, so the data in the cache, then to the save button to determine whether a data set is Modified, but has false
Don't tell the modified data, solving,
CodePudding user response:
Modified can only judge the current record, move and then can't judge,If opened ltBatchOptimistic, can be judged by UpdateStatus, or do some processing in query BeforePost events,
CodePudding user response:
TDataSource. OnUpdateData data update before triggeringTDataSource. OnDataChange data change after trigger
CodePudding user response:
I wanted to judge whether there is a change in the save button, if change the pop-up prompts, whether to save, so don't judge by Modified, it can't judge!CodePudding user response:
This can do it, will begin with a save button is disabled, then in the DataSource OnStateChange judgmentIf the DataSource. State in [dsInsert dsEdit] then
The begin
BtnSave. Enabled:=True;
The end;
CodePudding user response:
Only within the data set judgment, the outside judgment basically can't,TDataSet records set and buffer, you want to determine whether changes can only from the recordset comparing with buffer
CodePudding user response:
Data set changecount> 0CodePudding user response:
Declare a variable in the formIsChanged: Boolean;
Data sets of AfterPost the
IsChanged:=True;
In the AfterOpen
IsChanged:=False;
Save the incident
IsChanged:=False;
CodePudding user response:
Supplement:In the data set AfterPost can save button opens the
CodePudding user response:
Use clientData, use changeCount, enable the combine control interface, didn't have a little raw database for a long time