Spread Windows Forms 7.0 Product Documentation
Specifying the Data to Use
Support Options
Spread Windows Forms 7.0 Product Documentation > Developer's Guide > Managing Data Binding > Tutorial: Binding to a Corporate Database > Specifying the Data to Use

Glossary Item Box

Now that you have specified the database to use, you need to retrieve the records from the database table you want to display in your Spread control. To do this, you will use the OleDbDataAdapter control.

  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 OleDbDataAdapter control to add it to your form.

    The OleDbDataAdapter control is added in the area below the visible area of the form. The Data Adapter Configuration Wizard appears.

  4. Choose Next to begin completing the wizard.
  5. In the Choose Your Data Connection dialog, under Which data connection should the data adapter use? select the connection you created in Step 2 from the drop-down list. Then choose Next.
  6. In the Choose a Query Type dialog, select Use SQL statements and then choose Next.
  7. In the Generate the SQL statements dialog, choose Query Builder.

    The Add Table dialog appears to let you specify the table to use in the database.

  8. Select the Products table from the list and choose Add, then choose Close.
  9. In the Query Builder dialog, the Product table appears in a window, with a list of the available fields in the table. Select the following fields:
    • LeadTime
    • ProductDescription
    • ProductName
    • UnitPrice
  10. The Query Builder creates your SQL query in the status box. Your dialog should look like this:

    Query builder

  11. Choose OK to close the Query Builder dialog, then choose Next in the wizard.
  12. The wizard summarizes your choices. Choose Finish to complete the wizard.
  13. Press F4 to display the Properties window for the OleDbDataAdapter control.
  14. In the Properties window, change the name of the control to dbAdapt.
© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.