MyQuery1.SQL.Text := 'select id,name,0.00 as saldo from Customers';
MyQuery1.Execute;
While not MyQuery1.Eof do
Begin
MyQuery1.Edit;
MyQuery1.FieldByName ('saldo').AsFloat := 20;
MyQuery1.Next;
End;
The version 5.10 it works correctly.
The version 5.20 the following error
//#42522 Unknown column saldo in field list
#42522 Unknown column saldo in field list
-
cybsistemas
- Posts: 118
- Joined: Mon 12 Sep 2005 17:31
- Location: Argentina
Verify if the table 'Customers' has field 'saldo'. If it has not, then the error arises because on assigning a value to this field TMyQuery tries to save it in the database.
If you want to use this field as local, set the TMyQuery.Options.SetFieldsReadOnly property to True, and then for 'saldo' field the ReadOnly property to False.
Use MyDAC version 5.20.1.14.
If you want to use this field as local, set the TMyQuery.Options.SetFieldsReadOnly property to True, and then for 'saldo' field the ReadOnly property to False.
Use MyDAC version 5.20.1.14.
-
cybsistemas
- Posts: 118
- Joined: Mon 12 Sep 2005 17:31
- Location: Argentina
You should use the following code:
If you set the SetFieldsReadOnly property to True then 'saldo' field won't be included to queries of updating table. As for this it is set as read only.
In order to use it as a variable virtual field set ReadOnly to false.
Code: Select all
MyQuery1.Options.SetFieldsReadOnly := True;
MyQuery1.FieldByName('saldo').ReadOnly := False;In order to use it as a variable virtual field set ReadOnly to false.