Thread: Chapter 15!!
View Single Post
  #9 (permalink)  
Old March 10th, 2004, 07:41 AM
studentinpain studentinpain is offline
Authorized User
 
Join Date: Mar 2004
Location: Plymouth, , United Kingdom.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Set objConn = Server.CreateObject("ADODB.Connection")

We are using the connection object above.

We are happy that the mappath to the database is correct as when this is modified by removing goinggoinggone we are getting the same result, below.

Sql Statement is insert into Person(emailaddress, [password], familyname, givenname, StreetAddress1, StreetAddress2, City, State, PostalCode, Country, active, lastlogin) values ('Me@you.com','123','Man','Super','6 Krypton Street','','Kypton City','Cornwall','KR1 5TT','Krypton',1,#3/9/2004 7:50:13 AM#);

We have ran the sql statement in access and got it working by creating a new form within access, so we are fairly happy that it is work correctly.

The error message we are getting with Show friendly HTTP error messages disabled is shown below.

ADODB.Recordset error '800a0cb3'

Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype.

/goinggoinggone/AddUser.asp, line 41

Line 41 is in red!


<%
  Dim rsUsers
  Set rsUsers = Server.CreateObject("ADODB.Recordset")
  rsUsers.Open "Person", objConn
  If Session("PersonID") <> "" Then ' currently logged-on user
    rsUsers.Filter = "PersonID = '" & Session("PersonID") & "'"
  Else ' New session
    rsUsers.Filter = "EMailAddress = '" & Request.Form("email") & "'" & _
                     "AND Password = '" & Request.Form("password") & "'"
   If rsUsers.EOF Then ' User not found
      'rsUsers.AddNew ' ...so add a new record
      insertSQL = "insert into Person(emailaddress, [password], familyname, givenname, StreetAddress1, StreetAddress2, City, State, PostalCode, Country, active, lastlogin) " & "values ('" & Request.Form("email") & "','" & Request.Form("password") & "','" & Request.Form("FamilyName") & "','" & Request.Form("GivenName") & "','" & Request.Form("Address1") & "','" & Request.Form("Address2") & "','" & Request.Form("City") & "','" & Request.Form("State") & "','" & Request.Form("PostalCode") & "','" & Request.Form("Country") & "',1,#" & Now & "#);"
'Response.Write("Sql Statement is " & insertSQL)
'Response.End
objConn.execute insertSQL

' Else
' Email address and password matched with DB records -
' In this case we'll allow this to update user's personal details
    End If
  End If
                                                  ' write personal details to record
  'rsUsers("EMailAddress") = Request.Form("email")
  'rsUsers("Password") = Request.Form("password")
  'rsUsers("FamilyName") = Request.Form("FamilyName")
  'rsUsers("GivenName") = Request.Form("GivenName")
  'rsUsers("StreetAddress1") = Request.Form("Address1")
  'rsUsers("StreetAddress2") = Request.Form("Address2")
  'rsUsers("City") = Request.Form("City")
  'rsUsers("State") = Request.Form("State")
  'rsUsers("PostalCode") = Request.Form("PostalCode")
  'rsUsers("Country") = Request.Form("Country")
  'rsUsers("Active") = True
  'rsUsers("LastLogin") = Now
  'rsUsers.Update ' update the database

  Dim strName, strValue ' create session variables
  For each strField in rsUsers.Fields
    strName = strField.Name
    strValue = strField.value
    Session(strName) = strValue
  Next
  Session("blnValidUser") = True ' declare that current user is validated
  Response.Redirect "MenuForRegisteredUsers.asp"
%>

Thanks again,