Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 2156

Summary: "Dataset not in edit or insert mode" when Append or Insert by code
Product: TeeGrid for Delphi Reporter: yeray alonso <yeray>
Component: GridAssignee: david berneda <david>
Status: RESOLVED FIXED    
Severity: major CC: marc
Priority: High    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Chart Series: --- Delphi / C++ Builder RAD IDE Version:
Attachments: test project

Description yeray alonso 2019-02-15 04:59:38 EST
Created attachment 886 [details]
test project

See the project attached. This error appears when you Append or Insert (Edit mode works fine):

Project Project5.exe raised exception class EDatabaseError with message 'ClientDataSet1: Dataset not in edit or insert mode'.

If you unlink the TeeGrid and leave only the DBGrid linked to the datasource, both Append and Edit modes work perfectly.
Comment 1 yeray alonso 2019-02-15 05:15:30 EST
Both the Append and the Insert methods set the DataSet Status to dsInsert and they fire the DataSetChange event.
The DataSetChange event in TeeGrid refreshes the DataSet producing this Call Stack:

Data.DB.TDataSet.Cancel
Datasnap.DBClient.TCustomClientDataSet.Cancel
Data.DB.TDataSet.CheckBrowseMode
Data.DB.TDataSet.Last
Tee.GridData.DB.TVirtualDBData.FetchAllRecords
Tee.GridData.DB.TVirtualDBData.InternalRefresh
Tee.GridData.TVirtualData.Refresh
Tee.GridData.DB.TVirtualDataLink.DataSetChanged

The problem is the Cancel function sets the State to dsBrowse and that's what causes the error later.