Fórum Grid ou DBGrid #213761
13/02/2004
0
Por favor, como faço para colocar o resultado de um consulta SQL em um Grid ou DBGrid? Por favor preciso muito saber!
Paid
Curtir tópico
+ 0
Responder
Posts
13/02/2004
Fabio.hc
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)
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)
Responder
Gostei + 0
13/02/2004
Aroldo Zanela
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.
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.
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)