Interview Questions

How do we get access to a database from Delphi?

Delphi Interview Questions


(Continued from previous question...)

How do we get access to a database from Delphi?

In general, you have to go to "BDE Config" and define an alias for the database you want to connect to. This allows you to avoid hard-coding a directory path into your application; you just refer to the alias. Then, you create a minimum of three objects on the desktop: A Query or Table object that actually talks to the alias and gets some data; a Data Source object that links between the data and the controls, and at least one data-aware control.

If you've been trying for hours to get this to work, and no matter what you do you just don't see anything happening, try setting the "active" property on the Table or Query to "True." This will open the database. I have seen many people get caught out by this the first time they try it.

(Continued on next question...)

Other Interview Questions