The DBGrid with dynamic columns cannot be entered manually, and can't get value

procedure TFormGzffmxb.FormShow(Sender: TObject);
var
dbColumn: TColumnEh;

dbColumn:=DBGridEh1.Columns.Add;
dbColumn.Index:=DBGridEh1.Columns.count-1;
dbColumn.Title.Caption:=FieldByName('qm').AsString;
dbColumn.FieldName:='je_'+FieldByName('bh').AsString;
dbColumn.Width:=84;
dbColumn.ReadOnly:=False;//Here can not be manually input

for i :=0 to DBGridEh1.Columns.count-1 do
begin
ShowMessage(DBGridEh1.Fields[i].FieldName);//Dynamic and are listed here for less than the value of

I used the control is DBGridEh, DBGrid is the same for less than the value, why, how?

Started by Owen at February 01, 2016 - 4:21 AM

Also encountered such a problem, I.

Posted by Alston at February 02, 2016 - 4:30 AM

Posted by Mary at February 03, 2016 - 4:40 AM

dbColumn.FieldName:='je_'+FieldByName('bh').AsString;This sentence is wrong.
If you change: dbColumn.FieldName:='bh'; surely correct. But not what you need.
This should be "a calculated field".
For example: add a new field for XBH, let its value ='je_'+FieldByName ('bh').AsString on the line (actually not write).
Double click the ADOTable1 V field editor, then the new field can summon a calculated field editing window.

Posted by Bard at January 07, 2017 - 3:53 AM