



(3 ratings)
First, create a database with a table called myCustomers
with the following fields and add some data:
Company - text field
Address - text field
City - text field
State - text field
Zipcode - number field
As a reminder, here is our open database connection code:
|
Now, if you know that you only have one customer in your database to display, it is very simple. Just paste the below code into the body section of your page:
|
This will neatly display your customer's data on your page.
| When displaying data from a database on your pages, it is a good idea to use tables to organize how the data will be displayed. |
Now, ideally you will have more than one customer. If have multiple customers in your database, you need to do a little bit more
|
In the first example, our page displays the first and only record returned by our mySQL statement. In this example, the <% DO WHILE NOT objRS.EOF %> and <% objRS.MoveNext...Loop %> code instructs our page to display the first record returned by our mySQL statement, move to the next record, and loop back and continue the table and display the next record until there are no more records left.
So what happens if you have 100 customers and it is just too much information to display on one page? You would probably just want to display the first 10 or 20 records on your page and include a next and previous link at the bottom so that you can scroll through your records more easily. We will get into that later, but for now we will let you absorb this. Congrats!
20 Random Tutorials from the same category :
Reading a Database
ASP Components
Creating Databases
AIM Profile Screenname Viewer as a component of AIM Profile Designs
Recordset Access Methods
Processing Form Information In ASP
Using Application Variables
Text Editors and Software to Write ASP
Counting Visitors In ASP
Displaying Server Values In ASP
NEW WAY TO HANDLE VARIABLES
Iterating through Collections In ASP
FORMAT SPECIAL DATA
Randomizer for ASP
Counter in ASP
GLOBAL.ASA IN ASP
Date and Time Functions In ASP
DISPLAY DATA FROM DATABASE
Installing ASP on your own computer
Server Variables In ASP













