Database Concepts  «Prev  Next»
Lesson 7 Data binding
Objective Bind a database to an environment.

Binding Data to Environment

The user's view of a database is a Web page displayed in the browser. In the client-server architecture, the browser is not connected to the database. How then, does the data get from the database to the browser?
Assume for a moment that the BigBook.com application has an author search capability.
A user enters an author's name into a text box and clicks the search button and, in a matter of seconds, book titles by the specified author are displayed in the browser window.

A behind the scenes look

When the search button is clicked, an HTTP request[1] is submitted to the Web server.
The Web server processes the request by running server-side script.
The script connects to the database and executes a query that returns one or more records from the database. The results of the query are referred to as a recordset. The server then returns the records from the recordset back to the browser as plain 'ole HTML. In the process, data is bound to objects and controls.
For example, query results are bound to a recordset object or control, and individual data items are bound to HTML controls, such as text boxes.

Client Request

Visual Studio Design-Time Controls can take care of most, if not all, of the data binding and presentation tasks for you. Design-Time controls are used when the application is being built. The Web author drags a Design-Time Control into the page, and the control generates the necessary program code to perform the desired task.
You will learn more about Design-Time Controls in the Module titled, "Data Access with Visual Studio".
In the remainder of this lesson, you'll add another asp file to the VirtualBookShelf project. This file, sqlfun.asp, which contains VBScript code that makes a connection to the virtualbook.mdb database, executes a SQL query that returns a recordset object and finally displays the records in an HTML table.
This example serves two purposes: first, it gives you a quick look into how the process of querying and returning data work in a VBScriptprogram, and second, it provides a good asp file to use in the next module, "Essential SQL."
The following SlideShow shows you how to insert the file. It assumes the file is in the directory: c:\My Documents\Visual Studio Projects\VirtualBook\VirtualBook_Local.

A behind the scenes look


Inserting ASP File
In the next lesson, insert SQL statements to query the database will be discussed.

[1] HTTP request: A function provided by the Hypertext Transfer Protocol to request an action of the Web server.