Part VI: Capturing Customer Data

In this part of the project, you will save the additional information provided by the user. The data can be used later for mailing lists or for list server applications. Capturing the additional data is a simple matter of using ActiveX Data Objects (ADO) to write a new record to the Customers table.

Step 1

If you don't already have the EMailInfo project open, open it now. Add the following code to the BODY section of MAIL.ASP:


NOTE: The SQL string in this step can be difficult to create. Pay close attention to the use of single quotes and double quotes. Single quotes designate text in the SQL language, while double quotes are used by VBScript to create strings.

<% ` Add the customer data Dim strSQL ` Build SQL string strSQL = "INSERT INTO Customers (FirstName,LastName,Address1," strSQL = strSQL & "Address2,City,State,Zip,EMail)" strSQL = strSQL & "VALUES (`" & Request.Form("txtFirstName") & "`" strSQL = strSQL & ",'" & Request.Form("txtLastName") & "`" strSQL = strSQL & ",'" & Request.Form("txtAddress1") & "`" strSQL = strSQL & ",'" & Request.Form("txtAddress2") & "`" strSQL = strSQL & ",'" & Request.Form("txtCity") & "`" strSQL = strSQL & ",'" & Request.Form("txtState") & "`" strSQL = strSQL & ",'" & Request.Form("txtZip") & "`" strSQL = strSQL & ",'" & Request.Form("txtEMail") & "`)" ` Execute statement objConnection.Execute strSQL ` Destroy objects objRecordset.Close objConnection.Close Set objRecordset = Nothing Set objConnection = Nothing %> 

Save your project.

Step 2

Test all the aspects of your new e-mail information system.



Programming Active Server Pages
Programming Active Server Pages (Microsoft Programming Series)
ISBN: 1572317000
EAN: 2147483647
Year: 1996
Pages: 84

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net