Hi,
In design-time:
1. add one query component,
2. attach DataSource1 (which the grid is connected to) to that query,
3. write query.SQL = 'SELECT * FROM tablename WHERE 1=2',
4. make the query active
in run time when you want your grid to display data (in a button click for example):
procedure TForm1.Button1Click(Sender
begin
DataSource1.DataSet := Table1;
Table1.Open;
end;
To hide the records again:
procedure TForm1.Button2Click(Sender
begin
DataSource1.DataSet := Query1;
Table1.Close;
end;
Regards, Geo
Main Topics
Browse All Topics





by: knightmadPosted on 2003-08-26 at 06:37:41ID: 9223799
Well, you question is hard to understand (maybe you should to clarify it for help up : ) But if I understood it correctly, you want your DBGrid to show the columns but not the data. You can do it adding the columns of the DBGrid by hand, double click the DBGrid and add columns in the way you want, and be sure your TTable (or whatever is the Dataset) active property is set to false before to compile your program.