VDataSource1:=TDataSource.Create(nil);
Q1:=TADOQuery.Create(nil);
Q1.Connection:=GetCon;
Q1.Close;
Q1.SQL.Add('select id, unitname from unit');
try
begin
Q1.Open;
Q1.close;
Q1.Locktype := ltBatchOptimistic;
Q1.open;
VDataSource1.DataSet:=Q1;
DBGrid.DataSource:=VDataSource1;
DBGrid.Columns[0].visible:=false;
DBGrid.ReadOnly := False;
// DBGrid.Columns[0].FieldName := 'unit';
//DBgrid.Columns[0].Title.Caption := '提问单位';
DBGrid.refresh;
end;
except
begin
showmessage('显示数据出错');
exit;
end;
end;
Q1.Close;
为什么数据在DBGrid中显示不出来啊!!
Q1:=TADOQuery.Create(nil);
Q1.Connection:=GetCon;
Q1.Close;
Q1.SQL.Add('select id, unitname from unit');
try
begin
Q1.Open;
Q1.close;
Q1.Locktype := ltBatchOptimistic;
Q1.open;
VDataSource1.DataSet:=Q1;
DBGrid.DataSource:=VDataSource1;
DBGrid.Columns[0].visible:=false;
DBGrid.ReadOnly := False;
// DBGrid.Columns[0].FieldName := 'unit';
//DBgrid.Columns[0].Title.Caption := '提问单位';
DBGrid.refresh;
end;
except
begin
showmessage('显示数据出错');
exit;
end;
end;
Q1.Close;
为什么数据在DBGrid中显示不出来啊!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货