Parameter Search of the Student Database.

The first thing to be done is to create the access database student:   Expression web is designed to work with Access2003.  If you are working with Access2007 or 2010 both will allow you to save the data base as 2003. 

Create the following two tables in an access database called Student
Table Student:
Field Name Data Type Length
First name text 30
MI text 2
Last name text 30
Address text 30
City text 30
State text 2
Zip text 10
age text 3
married text 1, y or n
Student ID text 10, Primary Key
Table Classes
Field Name Data Type length
Class ID text 10, Primary Key
Student ID text 10, Foreign Key
CRN text 10
Semester text 10
Units text 4
Grade text 2
Class name text 15


Once you have built your student database and populated it with some data,  you must import it into your website.  To do this logon to your web site:

1. In your web site if you do not have a FPDB folder you will have to create one by right clicking on the root of the site, selecting new, selecting folder, and then typing FPDB for the folder name. Once you have created the folder click on the folder to make it active.

2. Click file on the menu, click import, click file

File Import

You will see:

import file add mode

3. Click on add file: You will see:

Add file

4. Navigate to the folder containing the student database and click on it, then click open, then click ok.   The student database will be imported into the FPDB folder.

 Now to access the student database and parameter search by Lastname:

1. First make two separate pages.

a. searchstudent.aspx
b. resultstudent.aspx

2. Open searchstudent.aspx
    a. Drag the asp.net textbox control to the form.

textbox
    b. Give the textbox control the name of Lastname by going to the Tag Properties and changing the value of ID to Lastname.
(Lastname is the field in the database table student that we will be searching)

tag ID


    c. Drag from the asp.net controls/standard/Buttons a button and place it next to the textbox.

button


    d. Click on the button, go to the tag properties and change the text attribute of the button to "Search for student by last name"
    e. Under behavior, set the value of PostBackURL to resultsstudent.aspx.

text propertypostbackurl
    f.  Save the page

3. Open resultstudent.aspx
    a. Drag the asp.net gridView onto the page.

Grid view asp.net
    b. Select choose data source,

choose data source

 c. Click new data source:

data source window

 d. Click access:, Click OK

browse

e. browse to the database student located in the FPDB folder.
where clause

f. Select the results table from the name box and then select all the fields by clicking the column with the asterisk.


    c. Click the where button.

where clause
    d. choose the lastname field from the column list
    e. Leave the operator set at "=",
    f. Choose "Form" as the source
    g. Type lastname in the parameter properties form field box
    h. Leave the default value blank
    i. click Add,

j. Click OK, click next, click testquery,

text query

k. click OK, click Finish.
    l. Save page and close.
    m. Open searchstudent in browser and test.