Now that you have specified the database and the data to use from the database, you will create a data set to contain the data for your Spread component.
- 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 DataSet control to add it to your form.
- In the Add Dataset dialog, select Untyped dataset and choose OK.
- The DataSet control is added in the area below the visible area of the form.
- Press F4 to display the Properties window for the DataSet control.
- In the Properties window, change the name of the control to dbDataSet.
- Double-click on the form in your project to open the code window.
- Select the line
C# Copy Code // Put user code to initialize the page here.
Visual Basic Copy Code ' Put user code to initialize the page here.
and type the following code to replace it:
C# Copy Code DataSet ds; ds = dbDataSet; dbAdapt.Fill(ds);
Visual Basic Copy Code Dim ds As DataSet ds = dbDataSet dbAdapt.Fill(ds)
This fills the data set with the data from the database you specified, using the fields you specified when setting up the OleDbDataAdapter control.
Return to the overview of the Tutorial: Binding to a Corporate Database tutorial.