Using controls to select specific records from demographic data base.


Student Learning Outcomes:

1. Use controls to retrive specifice records from a database. 

Important Points:

1. Open a new page and save it as demographicselect.aspx.

When you save an aspx or asp page it must be in the root folder of the web site.

2. Go to the toolbox, go to controls, click on the + next to the data folder, then drag the grid view to your page:  You will see:

Grid view

3. Click the down arrow in the choose data source box and select new data source you will see:

data source

4. Click on Access Database: you will see:

choose source for data

5. Ether type in the path which would be fpdb/demographic.mdb or click browse and go to the database and select it.  Then click next and you will see:  Note: the fields will be different in this example than in demographic.

database field selection

6. In this case we only have one table, but if you had other tables you would click on the drop down arrow and select them or select a query from the database which is called a view.

7. Click the * box to select all of the fields, click where next.  You will see:

Selecting records from data base

8.  In this case we will select records based on the lastname field = wylie or one of the last names you have put into your access database.
    a. In column, click the drop down arrow and select Lastname field
    b. In operator field, click the drop down arrow and select =
    c. In source, click the drop down arrow and select form
    d. In form field, type in Lastname
    e. Click Add.

Selecting records using where clause

9. You will see:

selecting records lastname=wylie

10. click Ok, You will see:

sql statement added to selecting

11. Click Next, You will see:

select fields

12. Click test query.  You will see:

select records were clause

13. Click ok, you will see:

query results for lastname = wylie

14. Click finish.  You will see:

grid view of data in driver.mdb

15. Click on auto format you will see:

auto format choices

16. Select a format and click Ok.  You will see:

formatted output

17. Save the file and press F12. to display the page.

Best Practices: