Basic steps to view database results using GridView Control
This tutorial shows the steps needed to make a connection to a database and
bring up the records in the database onto a web page.
1. First you need a database. If you don't already have one in your web, then
make a single-table database (you will need Access or (the free) SQL Server
Express on your computer), fill in some data, and import it into a folder on
your computer. We will assume you have imported such an Access database into the
fpdb folder of your website.
2. Make a test.aspx page on your web and open it. Immediately you will see it
has a one-line form on the page. Click on the Tag Properties pane for the form
and change the ID from form1 to something sensible like "DatabaseResults"
3. Drag a GridView from the ASP.NET data controls onto the form. You will
immediately see the Common GridView Tasks box.
4. In the "Choose Data Source" box select "New Data Source", click on the Access
Database Icon and specify a sensible ID for the datasource and click OK
5. Click the Browse button, browse to the fbdb folder, highlight your database,
and click Open. Then click Next, which should bring up a window that shows your
database along with the table.
6. You can either select * to display all the fields in the database, or choose
to check the individual fields you would like to display. Click the Advance
button an select the "Generate Insert, Update, and Delete Statements" if you
would like the user to be able to edit and delete results in the database (in
many situations you would not want this). Then click OK to close that window,
click Next, Test Query, and Finish
7. Select "Enable Paging" and "Enable Sorting", (and "Enable Editing" and
"Enable Deleting if you choose)
8. Save your page, and then file / preview in browser (you will need to have
installed the development server that came with Expression in order to view aspx
pages). You should find all the results from your database, along with the the
ability for the user to do the things you have enabled.
For more advanced things you can do with database results, check the other
tutorials on this site.