Grid ou DBGrid

Delphi

13/02/2004

Por favor, como faço para colocar o resultado de um consulta SQL em um Grid ou DBGrid? Por favor preciso muito saber!


Paid

Paid

Curtidas 0

Respostas

Fabio.hc

Fabio.hc

13/02/2004

Vc coloca um TQuery e um TDatasource.
No Tquery vc coloca a instrução SQL.
Na propriedade datasource do dbgrid vc coloca o Tdatasource.

TQuery.open (os dados serão mostrados no dbgrid)


GOSTEI 0
Aroldo Zanela

Aroldo Zanela

13/02/2004

Colega,

To associate a data control with a dataset,

1Place a dataset in a data module (or on a form), and set its properties as appropriate.
2Place a data source in the same data module (or form). Using the Object Inspector, set its DataSet property to the dataset you placed in step 1.
3Place a data control from the Data Access page of the Component palette onto a form.
4Using the Object Inspector, set the DataSource property of the control to the data source component you placed in step 2.

5Set the DataField property of the control to the name of a field to display, or select a field name from the drop-down list for the property. This step does not apply to TDBGrid, TDBCtrlGrid, and TDBNavigator because they access all available fields in the dataset.
6Set the Active property of the dataset to True to display data in the control.


GOSTEI 0
POSTAR