Board index » delphi » Dataset not in edit or insert mode

Dataset not in edit or insert mode

Hello,

I'm trying to edit a table at run-time and get the following error.

"Dataset not in edit or insert mode"

This only happens on certain tables, all of which are Paradox files,
and i think it is due to the CanModify property.  Problem is do not
know how to change this.

I have looked through explorer, bde, database desktop etc etc for an
answer.

Which is???

Many thanks
Alex Deacon

 

Re:Dataset not in edit or insert mode


  Uh....  You do what it says.  Put the table in Editmode...
Table1.Insert;  You can edit your fields with no problems, but you can't
insert unless the table is in Editmode....

--
Jason Wallace
SL Software
Dark...@SLSoftware.reno.nv.us
--
"We are MicroSoft.  You will be assimilated.  Resistance is Futile."
--

Alexander deacon <a...@deaconology.clara.net> wrote in article
<3416ab69.22416...@news.clara.net>...

Quote

> Hello,

> I'm trying to edit a table at run-time and get the following error.

> "Dataset not in edit or insert mode"

> This only happens on certain tables, all of which are Paradox files,
> and i think it is due to the CanModify property.  Problem is do not
> know how to change this.

Re:Dataset not in edit or insert mode


On Wed, 10 Sep 1997 14:18:43 GMT,
a...@deaconology.clara.net (Alexander deacon) said:

Quote
> I'm trying to edit a table at run-time and get the following error.
> "Dataset not in edit or insert mode"

Then issue "Table1.Edit" in your code. Or perhaps set (TRUE) the
AutoEdit property of the TDatasource your controls are connected to.

Quote
> This only happens on certain tables, all of which are Paradox files,
> and i think it is due to the CanModify property.  Problem is do not
> know how to change this.

You can't. It's a read-only property that you can check to see if it is
possible to enter edit mode at all, IIRC. Some queries can't be edited.
If your table is write-protected or such, then CanModify will be FALSE.

   HTH,

--
Christian R. Conrad

----------------------------------------------------------------------
Proud and sole owner of all opinions (except quotes) expressed above!

Re:Dataset not in edit or insert mode


Quote
Alexander deacon wrote:

> Hello,

> I'm trying to edit a table at run-time and get the following error.

> "Dataset not in edit or insert mode"

> This only happens on certain tables, all of which are Paradox files,
> and i think it is due to the CanModify property.  Problem is do not
> know how to change this.

> I have looked through explorer, bde, database desktop etc etc for an
> answer.

> Which is???

> Many thanks
> Alex Deacon

query1.Edit;
query1.FieldByName('Name').AsString := 'John';
query1.Post;

Re:Dataset not in edit or insert mode


J?rgen Aase <jorg...@ifi.uio.no> wrote in article
<341A051C.3...@ifi.uio.no>...

Quote
> query1.Edit;
> query1.FieldByName('Name').AsString := 'John';
> query1.Post;

In order to be able to execute the commands described above, you need to
set the property RequestAlive to TRUE of the TQuery or TTable component.

Re:Dataset not in edit or insert mode


Quote
>I'm trying to edit a table at run-time and get the following error.

>"Dataset not in edit or insert mode"

Try using 'Table.Edit'
The problem comes because Delphi is too good at
taking care of things behind the scenes.  We use data-aware
components and then we get lazy.
In this case, if the user typed something into the DBEdit,
being data-aware it would automatically shift into edit mode.
But when you try to do it programmatically it doesn't.
You have to use Edit or Insert, and you might want to
use post when you are done.

Brad.

Other Threads