TField dynamic
I would like to extend the data base at run-time of the program over SQL.
Around the fields to process to be able I produce components dynamically.
If RequestLive of the query is set on false, also all this functions
marvelously, only with a updatable query has I the problem that I when
opening the data base an error message receives that the
field " userfield " can not be found. Which false I make or as can I the
problem go around. Are grateful for each tip! BDE and Interbase data base
are used.
Var
sql:string;
s:Tstringfield;
begin
sql:='alter table adress add USERFIELD VARCHAR(5)';
query1.SQL.Clear;
query1.SQL.Add(sql);
query1.ExecSQL;
Name:='USERFELD';
Adressquery.close;
s:=Tstringfield.Create(self);
s.FieldName:=name;
s.FieldKind:=fkData;
s.Name:=Adressquery.Name+name;
s.readonly:=false;
s.Index:=Adressquery.FieldCount;
s.DataSet:=Adressquery;
Adressquery.FieldDefs.Add(Adressquery.Name+name,ftstring,30,false);
Adressquery.FieldDefs.Update;
//At this line come the error
Adressquery.open;
end;
Sorry for my english!
Gerhard ecl.gmbh@t online.de