Skip to main content
Participant
November 11, 2009
Question

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

  • November 11, 2009
  • 1 reply
  • 707 views

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

This topic has been closed for replies.

1 reply

Participating Frequently
November 11, 2009

I don't think you can specify a locktype with the command object if you use the execute method. You will need to use the open method to set the lock and cursor. Check the MS KB's for more details.

Participant
November 22, 2009

Are you saying that adobe has sold all ASP developers down the river?

It sure seems they have, I used the included recordset navigation and it fails.

Since they changed to use the command object the cursor type cannot be set which leaves us hanging it appears.

Participating Frequently
November 22, 2009

Hi dvolle, I don't use the DW behaviors anymore so I'm not familiar with the code it produces in recent versions. But, you can create an updateable recordset with the command object. You would need to change the code to use the open method.  Create  the connection, recordset, and command objects indivually and then use the open method.