Local Data Sample 

Download sample

This sample demonstrates the local data features of Visual Studio 2005, including the Data Sources window, TableAdapters, and the BindingSource component. This sample also shows how you can build data-bound forms without having to write code, and it demonstrates how to connect to a database file in your project.

Security noteSecurity Note

This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.

To open the sample file in Solution Explorer

  1. Click Download Sample.

    The File Download message box appears.

  2. Click Open, and on the left column of the zip folder window, click Extract all files.

    The Extraction Wizard opens.

  3. Click Next. You can change the directory that the files will be extracted to, and then click Next again.

  4. Make sure that the Show extracted files check box is selected, and click Finish.

  5. Double-click the sample's .sln file.

    The sample solution is displayed in Solution Explorer. You might get a security warning that says the solution location is not trusted. Click OK to continue.

    Next, install the Northwind database.

To run the sample

  1. Browse to the Microsoft Download Center page (http://www.microsoft.com/downloads)

  2. In the Product/Technology box in the Search for a Download pane, select Access.

  3. In the Keywords box, type Northwind.

  4. Click Go.

  5. On the results page, follow the link to Access 2000 Tutorial: Northwind Traders Sample Database, and follow the download and installation instructions.

  6. Drag the Nwind.mdb file into Solution Explorer (on the Local Data project node).

    The Data Source Configuration Wizard opens.

  7. Click Cancel to exit the wizard.

  8. Press F5.

To view the sample documentation

  1. In Solution Explorer, double-click the Documentation folder.

  2. If you are using Visual Basic Express Edition, right-click ReadMe.htm in the Documentation folder. Choose View in Browser.

  3. If you are using another version of Visual Basic, double-click ReadMe.htm in the Documentation folder.

Requirements

This sample requires the Access sample database named Nwind.mdb. For more information, see How to: Install and Troubleshoot Database Components for Samples.

Demonstrates

Visual Studio 2005 introduces the Data Sources window, through which you can set up bindings not only to server-based data, but also to local data, Web services, and business objects. Dragging a table to a form results in a data-bound form, handling most of the steps that you needed to complete manually in previous versions.

The basic steps for creating an application like this are:

  1. Create a Windows Application project.

  2. Add a new data source.

  3. Select the display controls for table columns, or accept the default selections.

  4. Drag the table onto your form.

  5. Add the code for inserting, updating, and deleting records. Examine the code for the Click event of the Save item on the ToolStrip.

See Also

Community Additions

ADD
Show: