[thelist] ASP: object read only?

Casey Crookston casey at thecrookstons.com
Fri Jul 11 14:52:45 CDT 2003


Two questions.

First, I'm trying to update a record in my db (Access) and it keeps telling
me the object is read-only.  I thought that by specifying adLockOptimistic I
was making in not read only.  What else do I need to do? (See entire code
block below)

Second, I'm aware that this is the clumsy way to go about this process and I
would much rather just update the record from the SQL statement, but I'm not
sure of the VBScript syntax.  Any suggestions?  The query would look like
this: "UPDATE texts SET block = '"&block&"' WHERE text_id="&text_id" but
again it's the VBScript that I'm unsure of.

Many, many TIA's,

Casey

<!-- #INCLUDE FILE="../adovbs.inc" -->
<%
Dim Connect, rcrdSet, Query, text_id, text

text_id = request("text_id")

block = request("block")

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

Connect.Open "boser_db"

Set rcrdSet = Server.CreateObject("ADODB.RecordSet")

Query = "Select block FROM texts WHERE text_id="&text_id

rcrdSet.Open Query, Connect, adOpenStatic, adLockOptimistic

rcrdSet("block") = block

rcrdSet.Update

Connect.Close

%>



More information about the thelist mailing list