DataSetField.FieldCount得到其字段数;
Var
I,J :Integer;
D :TDBEdit;
begin
I := DataSetField.FieldCount;
for J := 0 to I - 1 do
begin
D := TDBEdit.Create(Self);
D.Parent := Form;
D.Left :=..;
D.Top :=..;
D.Width := ..;
D.Height :=..;
D.DataSet := ..;
D.DataField := ..;
D.Name := ..//可要可不要;
end;
Var
I,J :Integer;
D :TDBEdit;
begin
I := DataSetField.FieldCount;
for J := 0 to I - 1 do
begin
D := TDBEdit.Create(Self);
D.Parent := Form;
D.Left :=..;
D.Top :=..;
D.Width := ..;
D.Height :=..;
D.DataSet := ..;
D.DataField := ..;
D.Name := ..//可要可不要;
end;
var
..
begin
..create(application);
..showmodal/show;
end;
窗体上:
MyStringList := TStringList.Create;
try
Session.GetTableNames('DBDEMOS', '*.db',False, False, MyStringList);
ComboBox.Items = MyStringList;
finally
MyStringList.Free;
end;
然后在
ComboBox.onchange
begin
...
end;