Chapter 15 - Update sql db problem
This may have been answered already, but I couldn't find it. In the AddUser.asp file, everything works fine until it hits the rsUsers.Update line. The only msg that I get returned is The page cannot be displayed. It is connecting to the MS SQL db fine. I have tried opening it with optimistic, dynamic and keyset and I get the same results. Can anyone suggest anything else. Below is my modified code. Thanks.
<%
Dim rsUsers, intIDForNewRecord, adOpenKeyset, adLockOptimistic, adCmdTable
adOpenKeyset = 1
adLockOptimistic = 3
adCmdTable = &H0002
Set rsUsers = Server.CreateObject("ADODB.Recordset")
rsUsers.Open "UserBase", objConn, adOpenKeyset, adLockOptimistic, adCmdTable
rsUsers.Filter = "Email = '" & Request.Form("Email") & "'"
If Not rsUsers.EOF Then
Session("UserExist") = "True"
Session("Update") = "True"
Response.Redirect "Register.asp"
Else
rsUsers.Filter = 0
rsUsers.MoveLast
intIDForNewRecord = rsUsers("UserId") + 1
rsUsers.AddNew
rsUsers("UserId") = intIDForNewRecord
rsUsers("Email") = Request.Form("Email")
rsUsers("Password") = Request.Form("Password")
rsUsers("LastName") = Request.Form("LastName")
rsUsers("FirstName") = Request.Form("FirstName")
rsUsers("Address1") = Request.Form("Address1")
rsUsers("Address2") = Request.Form("Address2")
rsUsers("City") = Request.Form("City")
rsUsers("State") = Request.Form("State")
rsUsers("ZipCode") = Request.Form("ZipCode")
rsUsers.Update
End If
Dim strName, strValue For each strField in rsUsers.Fields
strName = strField.Name
strValue = strField.value
Session(strName) = strValue
Next
Session("blnValidUser") = True Response.Redirect "Login.asp"
%>
|