Creating a Data Source

1. On the Data menu, click Add New Data Source.

2. In the Data Source Configuration Wizard, select Database, and then click Next, as shown in Figure 7.17.

3. Click New Connection to open the Add Connection dialog box.

4. Select Microsoft Access Database File for the data source, and select the Northwind.mdb database on your computer. This assumes that you have Microsoft Access installed.

5. For this example, you will not set a password to log on to the database. Click Test Connection, and then click OK to close the Add Connection dialog box (see Figure 7.18).

6. Click Next on the Data Source Configuration Wizard.

Figure 7.17. Selecting the data source type in the Data Source Configuration Wizard

Add Connection

Enter information to connect to the selected data source or click "Change" to choose a different data source and/or provider. Data source:

¬°Microsoft Access Database File (OLE DB) Change... | Database file name:

|C:\Program Files\Microsoft Office\OFFICEll' Browse... | Log on to the database User name: |"

Password: |

Save my password

Test Connection

Figure 7.18. Adding a connection to the Northwind database in Microsoft Access

7. When prompted to copy the data file to your project, as shown in Figure 7.19, click No. (Clicking Yes adds a copy of the Northwind database to your project, and that is not necessary for this example.)

Figure 7.19. Adding the Northwind data source to the project

8. Click Next on the Data Source Configuration Wizard using the default connection string.

9. Select the Tables check box, as shown in Figure 7.20, and then click Finish.

Figure 7.20. Selecting database objects to use in the dataset

A new dataset is added to the Data Sources window. NorthwindDataSet contains tables named Customers, Order Details, and Orders. Next you'll add a data-bound NamedRange control to the worksheet.

0 0

Post a comment