Updating a field

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Panjevic

Updating a field

Post by Panjevic » Sun 03 Jul 2005 19:12

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.

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Tue 05 Jul 2005 12:24

Does this method work for example with BDE?

Panjevic

Post by Panjevic » Tue 05 Jul 2005 23:03

I don't know, haven't tried it.

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Wed 06 Jul 2005 09:12

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?

Panjevic

Post by Panjevic » Wed 06 Jul 2005 15:45

no. i just wanna change a fields value.

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Thu 07 Jul 2005 11:06

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;

Panjevic

Post by Panjevic » Fri 08 Jul 2005 07:17

No. still doesn't work. Edits ok, but ccan't insert. :?

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Fri 08 Jul 2005 14:01

Please specify what message you get on it.

Javan_Soft
Posts: 15
Joined: Wed 15 Jun 2005 09:43

Post by Javan_Soft » Tue 09 Aug 2005 05:29

Tyr using :

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

bcrdejong
Posts: 1
Joined: Fri 19 Aug 2005 12:29

Post by bcrdejong » Fri 19 Aug 2005 12:34

Check if Table.ChachedUpdates" is set to false, if not then that could be your problem.

Post Reply