You can read the database supported by the system
Program function: Display the Data Link Property Dialog by the underlying OLE DB drive, select the OLE DB Provider (Provider) supported by the system from the dialog box, open according to the provider of the selection, open you want to view Database. This program will select the database driver according to the provider of user dynamic selection, get the database connection string, use ADO to open the database. Also, establish a connection string, the user can use the secondary string as another static connection.
The main interface of the program is as follows.
Program how to use:
[1], select the file menu to connect the database, or directly click the toolbar to connect the database button. The Database Connection Properties dialog box appears. The default is the provider page. On this page, the service of the OLDB provider that the system can be provided is listed. Usually, if we use the file type Access database, then we choose Microsoft Jet 4.0 (or 3.51) OLE DB. Provider is OK. If you use an ODBC data source, we have to select Microsoft Ole DB Provider for ODBC Driver.
[2] From the Database Connection Properties dialog box, select the OLEDB provider, click Next, enter the connection page.
The connection page will differ depending on the selected provider, here, where we choose Microsoft Jet 4.0 Ole DB Provider, because I want to use the Access 2000 file type database, at which point the connection page is as follows:
Click to open the Database button and select the database file you want to open. Turn off the dialog box, click the test connection button in the connection page. If the connection is successful, the test connection is successfully dialog box, otherwise the connection failure dialog box will check if the data provider selects the correct and database file path. , Then try again.
[3] If you just want to view the database, you can go here. But if there is other requests such as reading and writing, click the advanced page of the Database Connection Properties dialog box, the following dialog box appears. Set content such as read and write permissions of the database in this dialog. Once all, you can see all information about this connection in all dialogs.
[4] After the database connection is complete, disconnect the menu button and get the connection string menu button to turn black, open the connection to disconnect under the file menu, or click the toolbar open connection button. Decide the same effect.
[5], click to view the next connection string menu, or the toolbar string button, you can display the connection string of this database connection. Users can copy this database to other use, as a database static connection string under the same conditions.
[6] After a database connection is established, a digital drop-down list is displayed in the tree control on the left, which is the name of all non-system tables in the database, and the user can open the table name. This database table, the table content is displayed on the right as a list.
After opening the database, the program interface is as follows.
Author Note: The program is not packaged, you need MFC dynamic connection library support; if there is any problems and suggestions, please send trim to tangshansf@sohu.com