Spread Windows Forms 10.0 Product Documentation
Step 2: Setting up the Database Connection

In this step, you will use a wizard to set up the database connection and the data set, including telling it the name of the database to use.

  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 BindingSource control to add it to your project.

    The BindingSource control is added to your form, in a new area created below the visible area of the form. The data controls added in this tutorial will all be placed in this area, instead of in the visible area of the form.

  4. If the Properties window is not displayed, press F4 to display the properties for the BindingSource control.
  5. In the Properties window, click the DataSource property. Then click the drop-down button on the right side of the property setting area.
  6. In the pop-up dialog that is displayed, choose Add Project Data Source. The Data Source Configuration Wizard appears.

Next, you will follow these steps to set up your database connection and data set in the wizard.

  1. Under Choose a Data Source Type, choose Database, then click Next.
  2. Under Choose a Database Model, choose Dataset, then click Next.
  3. Under Choose Your Data Connection, choose an existing data connection or click New Connection to display the Add Connection dialog.
  4. If you are adding a new connection,
    1. If necessary specify the data source as a Microsoft Access Database File, then click Browse to browse to the file at  \Program Files (x86)\GrapeCity\Spread Studio 9\Docs\Windows Forms\TutorialFiles\databind.mdb and then click Open.
    2. Click the Test Connection button.
    3. If you do not receive a message stating the "Test connection succeeded" retry these steps. If you received the message "Test connection succeeded," your connection is complete. Click OK to close the Add Connection dialog.
  5. In the wizard, click Next.
  6. Visual Studio displays a dialog that asks if you want to copy the database file to your project. Choose No.
  7. Under Save the Connection String to the Application Configuration File, make sure the box for Yes, save the connection as is checked, and accept the default name by clicking Next.
  8. Under Choose Your Database Objects, click the arrow next to Tables to drop-down the list of available tables. Click the arrow next to Products to display the list of fields in the Products table.
  9. In the list of fields, select the following fields:
    • ProductName
    • ProductDescription
    • UnitPrice
    • LeadTime
  10. Click Finish.

    The DatabindDataSet control is added to your project.

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options | Documentation Feedback