Page 1 of 1

Updating a field

Posted: Sun 03 Jul 2005 19:12
by Panjevic
I use to update a specific field in a table using

Code: Select all

table.edit;
table.fieldbyname('field_name').value := some_value;
but what it did was set table.state to dsinsert and later on when I wanted to insert a record using

Code: Select all

table.insertrecord([]);
it would report an error, whereas with tables in dsBrowse state everything went smooth. Is there any other way to update a field that would change back to dsBrowse after the update.

Posted: Tue 05 Jul 2005 12:24
by Ikar
Does this method work for example with BDE?

Posted: Tue 05 Jul 2005 23:03
by Panjevic
I don't know, haven't tried it.

Posted: Wed 06 Jul 2005 09:12
by Ikar
Do I catch you correctly that you try to change a field value so a result of this changing will not be passed to the server?

Posted: Wed 06 Jul 2005 15:45
by Panjevic
no. i just wanna change a fields value.

Posted: Thu 07 Jul 2005 11:06
by Ikar
In this case you should use the next code:

Code: Select all

table.edit;
table.fieldbyname('field_name').value := some_value;
table.post;
To insert a new record use:

Code: Select all

table.insert;
table.fieldbyname('field_name').value := some_value;
table.post;

Posted: Fri 08 Jul 2005 07:17
by Panjevic
No. still doesn't work. Edits ok, but ccan't insert. :?

Posted: Fri 08 Jul 2005 14:01
by Ikar
Please specify what message you get on it.

Posted: Tue 09 Aug 2005 05:29
by Javan_Soft
Tyr using :

table.edit;
table.fieldbyname('field_name').asvariant := some_value;
table.post;

Posted: Fri 19 Aug 2005 12:34
by bcrdejong
Check if Table.ChachedUpdates" is set to false, if not then that could be your problem.