Later versions of Visual Studio have data source controls that require fewer steps. This list of steps uses the AccessDataSource 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 AccessDataSource control (under the Data section in the toolbox) to place it on the form.
- Select Configure Data Source in the pop-up menu and browse to the data file (mdb file). You may need to add the mdb file to the project to see it in the browse dialog.
- Click Next.
- Select Specify columns from a table or view.
- Select Products under the Name: drop-down.
- Select ProductName, ProductDescription, UnitPrice, and LeadTime 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.Sheets[0].DataSource = AccessDataSource1;
Visual Basic Copy Code FpSpread1.Sheets(0).DataSource = AccessDataSource1
- 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