Updating the Profile
Introduction. Now
we need to develop an ASP that will be used so that shoppers who have
previously created a profile can update it. The file will be called
UpdateProfile.asp. This
ASP will make use of one stored procedure that actually performs the
update based on the e-mail address and password called sp_UpdateShopper.
First we will develop the stored procedure then the ASP. |
The Stored Procedure. This file should be called sp_UpdateShopper.asp. |
<%@ Language=VBScript %> <% Option Explicit %> <!--#include File="adovbs.inc"--> <% ' Open a connection to our SQL Server database ' We will use the ADO Driver connection Dim connfoxFire, strSQLCreate Set connfoxFire = Server.CreateObject("ADODB.Connection") connfoxFire.ConnectionString="Driver={SQL Server}; Server=cisdev.quinnipiac.edu;" & _ "Database=YourUserName;UID=cis; PWD=csatqu" connfoxFire.Open ' Creating the SQL String to create the stored procedure strSQLCreate = "CREATE PROCEDURE sp_UpdateShopper " & _ "@chrFirstName varchar(150), " & _ "@chrLastName varchar(150), " & _ "@chrAddress varchar(150), " & _ "@chrCity varchar(150), " & _ "@chrState varchar(150), " & _ "@chrProvince varchar(150), " & _ "@chrCountry varchar(100), " & _ "@chrZipCode varchar(50), " & _ "@chrPhone varchar(25), " & _ "@chrFax varchar(25), " & _ "@chrEmail varchar(100), " & _ "@chrPassword varchar(25), " & _ "@intCookie int, " & _ "@idShopper int " & _ "AS " & _ "update shopper set chrFirstName = @chrFirstName, " & _ "chrLastname = @chrLastName, " & _ "chrAddress = @chrAddress, " & _ "chrCity = @chrCity, " & _ "chrState = @chrState, " & _ "chrProvince = @chrProvince, " & _ "chrCountry = @chrCountry, " & _ "chrZipCode = @chrZipCode, " & _ "chrPhone = @chrPhone, " & _ "chrFax = @chrFax, " & _ "chrEmail = @chrEmail, " & _ "chrPassword = @chrPassword, " & _ "intCookie = @intCookie " & _ "where idShopper = @idShopper" connfoxFire.execute(strSQLCreate) connfoxFire.Close Set connfoxFire = Nothing Response.Write "<font size = 5>The SQL has executed</font>" %> |
As usual with any sp_filename.asp, you should upload the file, execute it once to create the stored procedure, then delete it from your root web. Though you are likely to want to save it on your development source computer for future reference and possible reuse. |
The UpdateProfile.asp.
This ASP is used to update the profile. The following UpdateProfile.asp
will
|
<%@ Language=VBScript %> <% ' **************************************************** ' UpdateProfile.asp - This page updates the profile ' based on the entries by the user. ' **************************************************** ' Retrieve all of the data that the user entered by using the request object. chrFirstName = request("chrFirstName") chrLastName = Request("chrLastName") chrAddress = Request("chrAddress") chrCity = Request("chrCity") chrState = Request("chrState") chrProvince = Request("chrProvince") chrCountry = Request("chrCountry") chrZipCode = Request("chrZipCode") chrPhone = Request("chrPhone") chrFax = Request("chrFax") chrEmail = Request("chrEmail") chrPassword = Request("chrPassword") intCookie = request("intCookie") ' Check to see if the first name was entered. if chrFirstName = "" then
end if
end if
end if
end if
else
end if
end if
end if
end if
end if
end if
else
end if |
This is another, essentially, purely processing script using other pages as the interface. |