我也碰到了这个问题,我是这样做的:动态给GRID的COLUMNS的各个FIELDNAME连上QUERY
的FIELDNAME连上。dbnavigator1.DataSource:=DataSource1;
DBgrideh1.DataSource:=DataSource1;
with DBgrideh1.DataSource.DataSet do
begin
with TDBgrideh(ActiveControl) do
begin
DisableControls;
if table1.Active then
begin
i:=0;
with DBgrideh1 do
begin
for i:=0 to table1.FieldCount-1 do
begin
columns.FieldName:=table1.Fields.FieldName;