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 control.
Using Code
- Select the dbAdapt OleDBDataAdapter control on the form.
- Press F4 to display the Properties window for the control, if it is not already displayed.
- Click the Generate Dataset verb at the bottom of the Properties window.
- The Generate Dataset dialog appears.
- Click OK to close the Generate Dataset dialog.
The new data set control is added to your form.
- Press F4 to display the Properties window for the new DataSet control, if it is not already displayed.
- 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.
- Type the following code in the Form_Load event:
Example
C# | Copy Code |
---|---|
DataSet ds; ds = dbDataSet; dbAdapt.Fill(ds); Dim ds As DataSet ds = dbDataSet dbAdapt.Fill(ds) |
VB | 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 list of steps for Tutorial: Binding to a Corporate Database.