In the Object Inspector is chosen property ConnectionString (Fig. Likewise is configured the ConnectionString property of ADOTable1 component.įirst select a component ADOConnection1. We carry out the setting of ConnectionString property of component ADOConnection1. To access the database file we need to select path to the file and set others options. This method has more general case and is best suited for cases where several components such as TADOTable or TADOQuery, used to access to one connection ADOConnection1. In the second case the connection is made via an optional component ADOConnection1.
There are two methods to connect to database using the above mentioned components (fig. Component DBGrid1 for data displaying from database After placing this component on the form, view of project window will be the following (fig. With the purpose of visualization data from tables is used TDBGrid component from “ Data Controls” palette. It is also possible to combine these components. Instead component ADOQuery you can use component ADOTable. The components from the palette “ dbGo” are designed to operate with databases on ADO technology, which is well suited for MS Access database. We place these components on the application form.įig. Save the project.įrom “ dbGo” tab of tool palette select components TADOConnection and TADOTable.įrom the “ Data Access” tab we select component TDataSource (fig. Create the projectĭetailed example of creating the project is described here.
#Microsoft access database example windows#
Need to connect database to Windows application. The scheme of relations between database tables The structure of database and connections between tables are shown in Figure 1.įig. Database is placed at disk by following path: C:\Programs\C++ Builder\Program_01_02_00_008\01_02_00_008_database.mdb Selecting and displaying table “Students“ĭatabase, which were created by Microsoft Access, is given.
LoginPrompt property of ADOConnection1 component An example of connecting database Microsoft Access to application