Customer Information

<% @ Language="JavaScript" %>

<HTML>
<HEAD><TITLE>
Confirmation</TITLE></HEAD>
<BODY>

<H1>Confirmation</H1>

<%

/********** SET UP CONNECTION & RECORDSET OBJECTS **********/

var adOpenDynamic = 2;
var adLockOptimistic = 3;
var adCmdTable = 0x0002;

// DSN-less connection string
var strDSN = "DRIVER={Microsoft Access Driver (*.mdb)};
                        DBQ=" + Server.MapPath("cust.mdb") +  ";"

/*
create a new instance of the ADO, same idea we use for
var someArrayVar = new Array();
var someDateVar = new Date(); or
var someImageVar = 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 Object
var
rsCust = Server.CreateObject("ADODB.RecordSet");

// Recordset Object
rsCust.Open("pif", conn, adOpenDynamic, adLockOptimistic, adCmdTable);

/********** END OF SET UP CONNECTION & RECORDSET OBJECTS **********/

/********** WRITE NEW RECORD TO THE DB **********/

// add new Record with the fields coming from the Data Form
rsCust.AddNew();

rsCust("Last") = Request("Last"); // put the value of "Last" into the Record field "Last"
rsCust("First") = Request("First");
rsCust("Address") = Request("Address");
rsCust("City") = Request("City");
rsCust("State") = Request("State");
rsCust("Zip") = Request("Postal");
rsCust("Age") = Request("Age");
rsCust("Income") = Request("Income");
rsCust("Sex") = Request("Sex");
rsCust("Email") = Request("Email");

// update the record by putting the new record into the database
rsCust.Update();

/********** END OF WRITE NEW RECORD TO THE DB **********/

/********** CLOSE & DESTROY ADO OBJECTS **********/

// close & delete the Recordset Object
rsCust.Close();
rsCust = null;

// close & delete the Connection Object
conn.
Close();
conn = null;

/*
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.
*/

/********** END OF CLOSE & DESTROY ADO OBJECTS **********/

%>

<H3>The Confirmation Process has been completed.</H3>

<H3>An e-mail confirmation has been sent to:

<A HREF=mailto:<% = Request("Email") %>?Subject=Registration%20Confirmation>

<% = Request("Email") %>

</A>.

</H3>

<H4><A HREF="../default.htm">Week 5</A></H4>

</BODY>
</HTML>