Spread Windows Forms 11.0 Product Documentation
Step 4: Creating the Data Set

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

  1. Select the dbAdapt OleDBDataAdapter control on the form.
  2. Press F4 to display the Properties window for the control, if it is not already displayed.
  3. Click the Generate Dataset verb at the bottom of the Properties window.
  4. The Generate Dataset dialog appears.
  5. Click OK to close the Generate Dataset dialog.

    The new data set control is added to your form.

  6. Press F4 to display the Properties window for the new DataSet control, if it is not already displayed.
  7. In the Properties window, change the name of the control to dbDataSet.
  8. Double-click on the form in your project to open the code window.
  9. Type the following code in the Form_Load event:

Example

C#
Copy Code
DataSet ds;
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.