Re: Using TADOConnection with TDBGrid



Chuck Conover wrote:

I am evaluating Delphi for windows V 10.0, and am trying to figure
out how to show a Sybase ASA table on a window. I got the
TADOConnection to connect to the db fine, but I could not get the
TSQLConnection to connect. I added a TDBGrid to the page, but the

TADOConnection and TSQLConnection are part of two different data access
component sets. TADOConnection is part of the ADO (dbGo) components
while TSQLConnection is part of dbExpress. The two are not compatible.
If you have questions about dbExpress you should post them in the
dbexpress newsgroup.

Datasource dropdown on the TDBGrid doesn't seem to recognize the
TADOConnection. So, if not a TDBGrid control, how do I use a
TADOConnection to display the data? I'm not above coding another
object, just don't know where to start.

To display data in a DBGrid using the ADO data access components you
need one TADOConnection, one TADODataSet and one TDataSource (from the
Data Access group in the tool palette).

Set the Connection property of the ADODataSet to the name of the
ADOConnection component.

Set the CommandText property of the ADODataSet to an SQL SELECT
statement.

Set the DataSet property of the DataSource to the ADODataSet.

Set the DataSource property of the DBGrid to the DataSource component.

Set the Active property of the ADODataSet to True and you should see
data in the DBGrid.

--
Bill Todd (TeamB)
.