Vishal Tiwari
Vishal Tiwari

Reputation: 751

Strange behaviour about "Dataset Not In Insert or Edit Mode..." Error

I am using Delphi 2010 with TFIBDataset components.

I am facing a very strange issue, I have two TFIBDataset components called DS1 and DS2.

When I am trying to post the data in DS1 as below:

DS1.Post;

I get the error saying that "Dataset Not In Insert or Edit Mode...".

I faced such errors related to the datasets whose data I am trying to post, but this completely new issue I am facing.

Even though I tried to make DS2 in edit mode as below:

DS2.Edit;
DS1.Post;

Then also I am getting the same error.

Any clue ?

Upvotes: -3

Views: 2186

Answers (2)

Vishal Tiwari
Vishal Tiwari

Reputation: 751

I got the code working by writing below code:

DS1.DisableContrils;
DS1.Post;
DS1.EnableContrils;

Upvotes: -1

Johann
Johann

Reputation: 163

I got the same issue and have doen the following to solve my problem:

 for I := 0 to  Datamodule1.ComponentCount - 1 do
 if Datamodule1.Components[I] is TADOTable then
  Begin
    if (TADOTable(datamodule1.Components[i]).State in [dsEdit, dsInsert]) then
     TADOTable(datamodule1.Components[i]).POST;
  End;

I hope this will help

Upvotes: 0

Related Questions