Before trying to connect your program to a database, you must create the database and an alias to it. Next you can add a table component
for each of your tables and a data source component
to your main form. Until you have confidence in your knowledge of databases you may also want to add a DBGrid
to the form.
For most of what you will do, the TTable will do most of your work. You will only need the TDataSource and TDBGrid if you want to show your table using the TDBGrid. The values you need to set in for the table in its Object Inspector (red rectangles) are:
|
|
| The data source severs as a connection between the Table and a DBGrid. The only thing that has to be set here is the DataSet - in this case the table you created. | |
| You can use the DBGrid to create a quick view of the table you are using. This is a good check to see if all the table's variables are set correctly. If the table is active, it will appear in the grid even if you are not running the program (see below). While the DBGrid is good for small tables, you will probably not be able to display large tables. All you need to do to activate the grid is assign the datasource to the source you just created. | |