Later versions of Visual Studio have data source controls that require fewer steps. This list of steps uses the SQLDataSource control to bind the Spread control.
- Start a new Visual Studio .NET project.
- Name the project databind.
- Name the form in the project binding.aspx.
- Add the FpSpread component to your project.
- Place the component on the form.
- If the Toolbox is not displayed, choose Toolbox from the View menu.
- Double-click the SqlDataSource control (under the Data section in the toolbox) to place it on the form.
- Select Configure Data Source in the pop-up menu. Select New Connection.
- Choose Microsoft Access Database File in the Choose Data Source dialog.
- Browse to the data file. Select the fpnorthwinds.mdb file installed in the Spread Studio\Common folder. Click Next.
- Choose whether to save the connection string in the application configuration file.
- Select Specify columns from a table or view (or use a stored procedure).
- Select Customers under the Name: drop-down.
- Select ContactName and Phone in the Columns: section.
- Select Next and Finish. The Test Query button can be used to test the connection before selecting Finish.
- Bind the data source to Spread by adding the following code to the form:
C# Copy Code FpSpread1.DataSource = SqlDataSource1;
Visual Basic Copy Code FpSpread1.DataSource = SqlDataSource1
- Run the project to see the results.
If you do not know how to add the FpSpread component to the project, complete the steps in Adding Spread to a Project