| <%
@ Language="JavaScript"
%>
<HTML>
<HEAD><TITLE>Customer
Information</TITLE></HEAD>
<BODY>
<H1>Customer
Information Listing</H1>
<%
//
DSN-less connection string
var strDSN = "DRIVER={Microsoft Access Driver (*.mdb)};
DBQ=" + Server.MapPath("cust.mdb")
+ ";"
// the SQL
Query
var strSQL = "SELECT * FROM pif"
/*
create a new instance of the ADO, same idea we use for
var someArray = new Array(); or
var someImage = new Image();
*/
var conn = Server.CreateObject("ADODB.Connection");
// open a
connection to the database
conn.Open(strDSN);
// create a
new instance of the ADO Recordset
rsCustomersList = Server.CreateObject("ADODB.RecordSet");
// Recordset
Object
rsCustomersList.Open(strSQL,
conn);
%>
-- Create the Table Header --
<TABLE COLSPAN="8"
CELLPADDING="5">
<TR>
<TD
ALIGN="CENTER"
BGCOLOR="#008080">
<FONT
STYLE="ARIAL NARROW"
COLOR="#FFFFFF"
SIZE="2">Contact
Name</FONT>
</TD>
<TD ALIGN="CENTER"
BGCOLOR="#008080">
<FONT
STYLE="ARIAL NARROW"
COLOR="#FFFFFF"
SIZE="2">Email
Address</FONT>
</TD>
<TD ALIGN="CENTER"
BGCOLOR="#008080">
<FONT
STYLE="ARIAL NARROW"
COLOR="#FFFFFF"
SIZE="2">Address</FONT>
</TD>
<TD ALIGN="CENTER"
BGCOLOR="#008080">
<FONT
STYLE="ARIAL NARROW"
COLOR="#FFFFFF"
SIZE="2">City</FONT>
</TD>
<TD ALIGN="CENTER"
BGCOLOR="#008080">
<FONT
STYLE="ARIAL NARROW"
COLOR="#FFFFFF"
SIZE="2">State</FONT>
</TD>
<TD ALIGN="CENTER"
BGCOLOR="#008080">
<FONT
STYLE="ARIAL NARROW"
COLOR="#FFFFFF"
SIZE="2">Income</FONT>
</TD>
<TD ALIGN="CENTER"
BGCOLOR="#008080">
<FONT
STYLE="ARIAL NARROW"
COLOR="#FFFFFF"
SIZE="2">Age</FONT>
</TD>
<TD
ALIGN="CENTER"
BGCOLOR="#008080">
<FONT
STYLE="ARIAL NARROW"
COLOR="#FFFFFF"
SIZE="2">Sex</FONT>
</TD>
</TR>
-- Dynamically display the Database's Records --
-- if we haven't reached the last record
display the record --
<%
while (!rsCustomersList.EOF)
{
%>
<TR>
<TD BGCOLOR="F7EFDE">
-- display the record's
field "First" Value & the record's field "Last"
Value --
<%
= rsCustomersList("First")
%> <%
= rsCustomersList("Last")
%>
</TD>
<TD BGCOLOR="F7EFDE">
-- display the record's
field "Email" Value - here we dynamically create the Mailto: --
<A
HREF="mailto:<%
= rsCustomersList("Email")
%>">
<%
= rsCustomersList("Email")
%>
</A>
</TD>
<TD BGCOLOR="F7EFDE">
<%
= rsCustomersList("Address")
%>
</TD>
<TD BGCOLOR="F7EFDE">
<%
= rsCustomersList("City")
%>
</TD>
<TD BGCOLOR="F7EFDE">
<%
= rsCustomersList("State")
%>
</TD>
<TD BGCOLOR="F7EFDE">
<%
= rsCustomersList("Income")
%>
</TD>
<TD BGCOLOR="F7EFDE">
<%
= rsCustomersList("Age")
%>
</TD>
<TD BGCOLOR="F7EFDE">
<%
= rsCustomersList("Sex")
%>
</TD>
</TR>
-- Go to the Next Record --
<%
rsCustomersList.MoveNext();
}
/*
-- Finally close & "destroy"
both the Recordset & Connection Objects --
Once you have finished with an Object, you should Close()
it and free any associated system resources. NOTE: This doesn't
actually remove the object from memory; so you can Open()
it again if you need to. To completely free the memory for the object
you should set it to null.
*/
rsCustomersList.Close();
rsCustomersList = null;
conn.Close();
conn = null;
%>
</TABLE>
<HR COLOR="CCCCCC"
SIZE="1">
<FONT SIZE="1"
FACE="Arial">
The names of companies, products, people, characters and/or data
mentioned herein are fictitious and are in no way intended to represent
any real individual, company, product or event unless otherwise noted.
</FONT>
</BODY>
</HTML> |