You might be wondering why we put the phone number in a text field
rather than a number field. Unless we need to do calculations with
numbers we often store the numbers in text fields. If we did not do this
then we would not be able to store 'numbers' like this phone number, for example:
(33)493665478.
Make a new page and save it immediately with the name viewselected.asp. In html view, replace any existing code with this:
<html><head><title>View
Selected Fields</title></head><body>
<h1>View Selected Fields as Paragraphs</h1>
<a href="addrecordform.htm">Add
a Record</a>
<a href="viewtable.asp">View
Table</a><hr>
<!--#include file="dbconnect.asp"-->
<%
' text1= family name, text2 = first name, text3 = email, text4 = phone
Dim objRS 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query for the database
Set objRS = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the
database
strSQL = "SELECT text1, text2, text3, text4 FROM main"
objRS.Open strSQL, objConn 'Open the recordset with the SQL query
'Loop through the recordset
Do While not objRS.EOF
'Write the HTML to display the current record in the
recordset
Response.Write objRS("text1") & ", " & objRS("text2")
& "<br>" ' family name, first name
Response.Write objRS("text3") & " " & objRS("text4") &
"<hr>" ' email, phone
objRS.MoveNext 'Move to the next
record in the recordset
Loop
'Reset server objects
objRS.Close
Set objRS = Nothing
objConn.close
Set objConn = Nothing
%>
</body></html>
Analysis: