Steps to access the database with the ADO components in Delphi

xiaoxiao2021-03-06  40

Today I used the ADO components in Delphi to successfully connect the database, below is the general steps:

New project

2. Add a Tadoconnection component in the form and set its Connectionstring property to connect to the database.

3. Add a Tadotable component and set its connection attribute to adoConnection1. Select a data table from the TABLENAME property.

4. Add a TDataSource component to set its DataSet property to adotable1.

5. Add a DataGrid component, set the DataSource property to DataSource

6. Set the ADOTABLE1's Active property to True.

7. Here is a design view:

7. Run the program test

The following program is running:

This simple example can illustrate a way of Delphi access to the database. The Tadotable control in the other example can be replaced with TadoQuery. TadoQuery can access multiple tables, while tadotable can only access a table.

Welcome everyone to communicate with me

转载请注明原文地址:https://www.9cbs.com/read-85736.html

New Post(0)