Board index » delphi » Edit method of TClientDataSet

Edit method of TClientDataSet


2003-06-30 08:05:29 AM
delphi82
Dear all,
I meet a problem with TClientDataSet.When a field comes from other
fields,Edit method of TClientDataSet raises errors.For an example:
with TClientDataSet do
begin
Close;
CommandText := ' SELECT *, AAA=Field1+Field2 FROM TABLE1 ';
....
Open;
FieldByName('AAA').ReadOnly := False;
Edit;
FieldByName('AAA').AsString := 'OK';
Post;
end;
If I use APPEND method, it is no problem, but EDIT method raises "The
field is readonly, cannot be modified".
Can you help me?Thanks.
 
 

Re:Edit method of TClientDataSet

I want to update data to the local for display and not commit to the
server.How can I do?
"lc" <XXXX@XXXXX.COM>
??????:XXXX@XXXXX.COM...
Quote
On Mon, 30 Jun 2003 08:05:29 +0800, "Oujiahan" <XXXX@XXXXX.COM>
writes:

>CommandText := ' SELECT *, AAA=Field1+Field2 FROM TABLE1 ';
>....
>Open;
>FieldByName('AAA').ReadOnly := False;
>Edit;
>FieldByName('AAA').AsString := 'OK';

File AAA must always be Read-Only. It doesn't really have a
corresponding field in the TABLE1 and, therefore, cannot be modified.

lc
 

Re:Edit method of TClientDataSet

On Mon, 30 Jun 2003 10:52:46 +0800, "Oujiahan" <XXXX@XXXXX.COM>
writes:
Quote
I want to update data to the local for display and not commit to the
server.How can I do?
Create an InternalCalc field instead. If you need to update it's
content (Field1+Field2) after data's been retrieved, you can do so in
OnCalcFields.
The advantage of using this field type over Calc field is that
InternalCalc can be edited as though it was a regular field.
lc