#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2001
    Location
    Washington DC, USA
    Posts
    156
    Rep Power
    14

    ASP datasource won't allow add / update?


    Code:
    <%
    ' set up and open database connection
    Set objConn = Server.CreateObject("ADODB.Connection") 
    objConn.Open "DSN=dsnname", "username", "password"
    
    Set objRS = Server.CreateObject("ADODB.Recordset")
    objRS.Open "pressrelease", objConn, adOpenDynamic
    objRS.AddNew
    %>
    When I try to execute this code, I get this error:

    Code:
    ADODB.Recordset error '800a0cb3' 
    Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype.
    However, when I make the below call, it returns true:

    Code:
    Response.Write(objRS.Supports(adAddNew))
    Any idea what the problem might be? Thanks very much for helping this ASP newbie.


    -Cliff
    Last edited by cliffyman; April 28th, 2003 at 02:24 PM.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Location
    Shimonoseki / JAPAN
    Posts
    58
    Rep Power
    12
    If you don't use any locktype, it uses adLockReadOnly by default. Try this:

    Code:
    objRS.Open "pressrelease", objConn, adOpenDynamic, adLockOptimistic
    Sweet smell of a great sorrow lies over the land. Plumes of smoke rise, merge into the leaden sky. A man lies and dreams of green fields and rivers, but awakes to a morning with no reason for waking. He's haunted by the memory of lost paradise. In his youth or dream, he can't be precise. He's chained forever to a world that's departed. It's not enough, it's not enough.
    Gilmour

IMN logo majestic logo threadwatch logo seochat tools logo