Spread for ASP.NET 12 Product Documentation
Binding Spread to the Database
Spread for ASP.NET 12 Product Documentation > Developer's Guide > Managing Data Binding > Tutorial: Binding to a Corporate Database > Binding Spread to the Database

Your data set is ready, now you need to add the Spread component to display the data, and provide code to bind the Spread component to the data set.

  1. Double-click on the form to open the code window.
  2. Type the following code below the code you added to create the data set:

    C#

    Copy Code
    FarPoint.Web.Spread.Model.DefaultSheetDataModel model = new FarPoint.Web.Spread.Model.DefaultSheetDataModel(dbDataSet);
    FpSpread1.Sheets[0].DataModel = model;
    
    Visual Basic
    Copy Code
    Dim model As FarPoint.Web.Spread.Model.DefaultSheetDataModel = New FarPoint.Web.Spread.Model.DefaultSheetDataModel(dbDataSet)
    FpSpread1.Sheets(0).DataModel = model
    
  3. Save your project.
  4. Run your project and you should see a form that looks similar to the following:

    Databound Spread Control

  5. If your form does not look similar to this form, adjust the size of your Spread component, and re-check the steps you have performed so far.
  6. Stop the project.