3 Replies Latest reply: Nov 22, 2009 1:13 PM by bregent RSS

    How to make an updateable recordset in CS4 (asp)?

    LoriKB Community Member

      Hello,

       

      I've been searching for a couple hours now and have been unable to find an answer to this question. I was using MX 2004 until recently (yes I know very old) but I was pretty set in my ways

       

      This is currently my enemy "Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype."

       

      I could correct this in previous versions by changing the locktype or cursorlocation/type but these don't seem to be available to change in a Command Object?

       

      Am I doomed to writing out all my recordsets from now on? I am sure the command object makes a more secure recordset but that doesn't help me if I can't write a simple update statement.

       

      If there is a way for me to make this updateable that would be great, if not please reply with that so I can atleast stop looking and just write the recordset (probably something I should have done after looking for 5 minutes with no answers lol)

       

      here is my code

       

      Set rsThisMember_cmd = Server.CreateObject ("ADODB.Command")
      rsThisMember_cmd.ActiveConnection = MM_Conn_UBF_STRING
      rsThisMember_cmd.CommandText = "SELECT * FROM dbo.tblCMS834_Temp WHERE Id = ?"
      rsThisMember_cmd.Prepared = true
      rsThisMember_cmd.Parameters.Append rsThisMember_cmd.CreateParameter("param1", 5, 1, -1, rsThisMember__MMColParam) ' adDouble
      Set rsThisMember = rsThisMember_cmd.Execute

       

      My update is conditional based on whether the user hits approve or reject and only changes two fields which is why I want to write my own update code rather than use the dreamweaver update server behavior.

       

      <% IF Request.ServerVariables("REQUEST_METHOD") = "POST" Then

      If Request.Form("Submit") = "Reject" Then
      rsThisMember.MoveFirst
      rsThisMember("Approved") = "No"
      rsThisMember("TimeStamp") = Date()
      rsThisMember.Update
      End If

      If Request.Form("Submit") = "Approve" Then
      rsThisMember.MoveFirst
      rsThisMember("Approved") = "Yes"
      rsThisMember("TimeStamp") = Date()
      rsThisMember.Update
      End If

      End If
      %>

       

      I probably put in too much information but I figured it was better if people knew what I was trying to do. Should be simple. I am fne with writing my own recordset but this is something I do A LOT so it would be great if I knew if there was a way to change the Command Object rather than use Recordset.Open.

       

      Thanks so much,

      Lori