Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: need help figuring out this peculiar update problem


Message #1 by "Tin Danicker" <reverseassmosis@y...> on Thu, 21 Mar 2002 17:18:34
I am trying to update a record in my access database.  What i have right 
now, is the data being called from the database and displayed in the text 
fields for the user to change the data.

then they click on SAVE, and it calls the update to database asp file.  

My problem is that it goes to the next page and doesn't update the 
database with the changes, BUT if i press the back button on my browser 
and click SAVE again, it saves the updates.

here is the code in the update the database asp file.  I have tried 
several ways to set up the command object as you'll notice with the 
strFirstName, it doesn't make a difference..

thanks to anyone who has any ideas on what i am doing wrong..

'Declaring variables to hold inputed username and password
Dim strFirstName, strLastName, strPosition, strGroupHome, strEmail, 
strUserName, strPassword
Dim rsObject
  
'Getting the username and password from RegisterUser.asp
  strFirstName = Request.Form("txtFirstName")
  strLastName = Request.Form("txtLastName")
  strPosition = Request.Form("cboPosition")
  strGroupHome = Request.Form("cboGroupHome")
  strEmail = Request.Form("txtEAddress")
  strUserName = Request.Form("txtUserName")
  strPassword = Request.Form("txtPassword")
  
  
 strUserID = Request.QueryString("action")
  
' Create the recordset object	
  Set rsObject = Server.CreateObject("ADODB.Recordset")
   
  Set objComm = Server.CreateObject("ADODB.Command")
  objComm.ActiveConnection = strConnect

' do the objectCommand for grouphome
  objComm.CommandText = "qryUpdateUser"
  objComm.CommandType = adCmdStoredProc
  objComm.Parameters.Append objComm.CreateParameter("@FirstName", 
adVarChar, adParamInput, 25)
  objComm.Parameters.Append objComm.CreateParameter("@LastName", 
adVarChar, adParamInput, 25, strLastName)
  objComm.Parameters.Append objComm.CreateParameter("@Position", 
adVarChar, adParamInput, 20, strPosition)
  objComm.Parameters.Append objComm.CreateParameter("@GroupHome", 
adVarChar, adParamInput, 20, strGroupHome)
  objComm.Parameters.Append objComm.CreateParameter("@EAddress", 
adVarChar, adParamInput, 50, strEmail)
  objComm.Parameters.Append objComm.CreateParameter("@UserName", 
adVarChar, adParamInput, 15, strUserName)
  objComm.Parameters.Append objComm.CreateParameter("@Password", 
adVarChar, adParamInput, 15, strPassword)
  objComm.Parameters.Append objComm.CreateParameter("@UserID", adVarChar, 
adParamInput, 20, strUserID)

  strFirstName = Request.Form("txtFirstName")
  objComm.Parameters("@FirstName") = strFirstName
		
  Set rsObject = objComm.Execute 
  Set objComm = Nothing
  Set objParam = Nothing

  Return to Index