Local Data Sample
This sample demonstrates the local data features of Visual Studio 2005. This includes 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
To get samples and instructions for installing them
Do one or more of the following:
On the Help menu, click Samples.
The Readme displays information about samples.
Visit the Visual Studio 2008 Samples Web site. The most recent versions of samples are available there.
Locate samples on the computer on which Visual Studio is installed. By default, samples and a Readme file are installed in drive:\Program Files\Microsoft Visual Studio 9.0\Samples\lcid. For Express editions of Visual Studio, all samples are located online.
For more information, see Visual Studio Samples.
This sample code is intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Microsoft provides this sample code "AS IS" with no warranties.
To run the sample
Locate this sample on the MSDN Web site, and then download and open the sample.
Browse to the Microsoft Download Center page (http://www.microsoft.com/downloads)
In the Product/Technology box in the Search for a Download pane, select Access.
In the Keywords box, type Northwind.
On the results page, follow the link to Access 2000 Tutorial: Northwind Traders Sample Database, and follow the download and installation instructions.
Drag the Nwind.mdb file into Solution Explorer (on the Local Data project node).
The Data Source Configuration Wizard opens.
Click Cancel to exit the wizard.
To view the sample documentation
In Solution Explorer, double-click the Documentation folder.
If you are using Visual Basic Express, right-click ReadMe.htm in the Documentation folder. Choose View in Browser.
If you are using another version of Visual Basic, double-click ReadMe.htm in the Documentation folder.
This sample requires the Access sample database named Nwind.mdb. For more information, see How to: Install and Troubleshoot Database Components for Samples.
Visual Studio includes 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 creates a data-bound form, handling most of the steps that you had to complete manually in earlier versions.
The basic steps for creating an application such as this are as follows:
Create a Windows Application project.
Add a new data source.
Select the display controls for table columns, or accept the default selections.
Drag the table onto the form.
Add the code for inserting, updating, and deleting records. Examine the code for the Click event of the Save item on the ToolStrip.