Page 1 of 1
#42522 Unknown column saldo in field list
Posted: Fri 08 Feb 2008 00:30
by cybsistemas
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
Posted: Tue 19 Feb 2008 12:59
by Dimon
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.
Posted: Thu 21 Feb 2008 21:20
by cybsistemas
I did that, but you tell me that the field cannot get modified.
I pay out the field not this at the table, it is a virtual field.
Posted: Fri 22 Feb 2008 15:03
by Dimon
You should use the following code:
Code: Select all
MyQuery1.Options.SetFieldsReadOnly := True;
MyQuery1.FieldByName('saldo').ReadOnly := False;
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.
Posted: Fri 22 Feb 2008 23:41
by cybsistemas
Thanks