You must tell the project which database you want to use. In this step, you will add a OleDbConnection control to your form, and tell it the name of the database to use.
- If the Toolbox is not displayed, from the View menu choose Toolbox.
- Click the Data tab to display the available data controls.
- Double-click the OleDbConnection control to add it to your form.
The OleDbConnection control is added to your form, in a new area created below the visible area of the form. The data controls you create in this tutorial will all be placed in this area, instead of in the visible area of the form.
- Press F4 to display the Properties window for the OleDbConnection control.
- In the Properties window, change the name of the control to dbConnect.
- In the Properties window, click the ConnectionString property.
- Click the down arrow displayed on the right side of the setting area, then select New Connection from the drop-down list.
The Data Link Properties dialog is displayed.
- Click the Provider tab, and then select Microsoft Jet 4.0 OLE DB Provider from the list.
- Click Next.
- Next to the Select or enter a database name box, click the Browse button.
- Browse to C:\Program Files (x86)\GrapeCity\Spread.NET 11\Docs\Windows Forms\TutorialFiles\databind.mdb and then choose Open.
- Click the Test Connection button.
- If you do not receive a message stating the "Test connection succeeded" retry steps 6 through 12.
- If you received the message "Test connection succeeded," your connection is complete. Click OK to close the Data Link Properties dialog.