Spread for ASP.NET 12 Product Documentation
Creating the Data Set
Spread for ASP.NET 12 Product Documentation > Developer's Guide > Managing Data Binding > Tutorial: Binding to a Corporate Database > 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 component.

  1. If the Toolbox is not displayed, from the View menu choose Toolbox.
  2. Click the Data tab to display the available data controls.
  3. Double-click the DataSet control to add it to your form.
  4. In the Add Dataset dialog, select Untyped dataset and choose OK.
  5. The DataSet control is added in the area below the visible area of the form.
  6. Press F4 to display the Properties window for the DataSet control.
  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. 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.