Register the New Database with ODBC
You will register the new database with the ODBC data source name “Student Registration.” This data source name (DSN) is referred to by the Enroll application. You must register the database even if you are using the pre-built StdReg32.mdb Microsoft Access database file.
You can register the data source by using ODBC Administrator from the Control Panel, or by running StdReg.exe.
Note The STDREG tool is provided for use with this tutorial as a convenient method for registering data sources with ODBC and for populating databases with the appropriate tables and data. Normally, you will use ODBC Administrator from the Control Panel to register your data sources with the appropriate tables and data if you are not going to use the pre-built StdReg32.mdb database.
The following two procedures describe how to register the data source if you are using the Microsoft Access ODBC driver.
-
If you are using Microsoft Access and the StdReg.mdb, make sure you have copied the database to your hard drive before you perform the following procedures.
-
If you are using another driver, the basic procedure will vary somewhat. For more information, refer to the ODBC SDK topic, Adding Data Sources.
To register the data source by using ODBC
-
Open Control Panel, and double-click the 32bit ODBC icon.
-
Click the User DSN tab, if it is not already selected.
-
Click the Add button.
The Create New Data Source dialog box appears.
-
From the list, choose the driver you want to use with your database, in this case, Microsoft Access Driver (*.mdb), and then click Finish.
The ODBC Setup dialog box specific to the driver you indicated appears.
-
In the Data Source Name box, type
Student Registration
.
-
Optionally, in the Description box, enter a description for the database.
-
In the Database group box, click Select, and then navigate to the location of StdReg32.mdb.
-
Click OK to select the database.
-
Click OK to exit the ODBC Setup dialog box, and click Close to exit the ODBC Data Source Administrator dialog box.
To register the data source by using StdReg.exe
-
First run StdReg.exe, by using the following procedure:
-
Jump to the STDREG sample in Visual C++ Samples.
-
Click the link "Click to open or copy the STDREG project files."
-
The Sample Application dialog box appears
-
From the Files box, click StdReg.exe.
-
Click the Copy button.
-
The Copy dialog box appears.
-
Navigate to the directory where you want to copy the file and click OK.
-
Navigate to the location of StdReg.exe, and double-click to run the program.
-
Click Add Data Source.
-
Follow the instructions in steps 3 through 9 of the previous procedure.