SQLConfiguration SQLConfiguration

Database Concepts  «Prev  Next»
Lesson 6Setting up Data environment in .NET
ObjectiveInsert a data source into a project.

Setting Up Data Environment

Before you can access a database from your Web application you must make the application "aware" of the database. The VirtualBookShelf.com Web site will access a Microsoft Access database called

You associate a database with your Web application in Visual Studio by adding a Data Environment. The Data Environment contains the information needed to access the data. This information includes one or more logical connections and command objects .
The Global.asa file manages the Data Environment and the database connections. Therefore, they are available to all the Web pages in the application.
The following simulation guides you through setting up a Data Environment for the VirtualBookShelf.com project. This example assumes the database, virtualbook.mdb, is stored in the project directory. The path to the project directory should be something like: c:\My Documents\Visual Studio Projects\VirtualBookShelf\VirtualBookShelf_Local.

  1. logical connection: In the context of this course, refers to the association between the application and the datasource.
  2. command object: An object used to execute queries.
Settingup Virtual Bookshelf
The project now has a Data Environment and a connection to the VirtualBook database.
This Data Environment will be used throughout this course to access and manipulate the project database.
You will also use it with other Visual Studio tools such as the Query Designer.
In the next lesson, you will add an asp file to the VirtualBookShelf project and experiment with SQL statements.

Setting Up Data Environment

Click the Exercise link below to practice adding a data environment and database connection to the virtualbook.mdb database.
Setting Up Data Environment