在delphi中,要显示DBgrid的全部内容

2024-12-21 20:50:17
推荐回答(2个)
回答1:

需要在添加一个datasource控件,然后adodataset的datasource属性选择datasource1,dbgrid的datasource属性选择datasource1,然后在按钮中写:procedure TForm1.Button1Click(Sender: TObject);
beginADODataSet1.close;
ADODataSet1.CommandText:='select * from 表';
ADODataSet1.Open;
end;

回答2:

procedure TForm1.Button1Click(Sender: TObject);
begin
ADODataSet1.CommandText:='select * from my';
ADODataSet1.Open;
end;