Results 1 to 2 of 2

Thread: small problem....

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Posts
    67

    small problem....

    Hi,

    I have a link that when clicked goes to a page and parses the unique ID for use on that page - displaying fields.

    Thing is I want it so whoever clicks on the link locks it so other's can't follow the link. I've got most of it sorted by using a field in the database called 'status', when status is 1 then the record is locked (by default status = "0" ).

    Problem is when the database is opened on the second page (where I actually want to change the status of ID record to 1 so its locked) its seems its read only.

    I couldn't paste the exact code as I don't have it with me:

    Code:
    Dim ID		
    ID = Request.QueryString("ID") 
    Dim conCurrent
    Dim rstCurrent				
    Set conCurrent = Server.CreateObject("ADODB.Connection")
    Set rstCurrent = Server.CreateObject("ADODB.recordset")
    conCurrent.connectionString = "driver={Microsoft Access Driver (*.mdb)};" & _
     "dbq=/db/cdadg.mdb"
    conCurrent.Open
    strSQL="SELECT * FROM data WHERE Entry_ID=" & ID  
    Set rstCurrent = conCurrent.Execute(strSQL)	
    
    IF rstcurrent("status") = 0 THEN
      rstcurrent("status") = 1
      rstcurrent("namelocked") = session("name")
    END IF
    I think I probably require an SQL statement but i'm not sure and rstcurrent assigning just doesn't/won't work.

    Can anyone help?

    Hope I explained it ok

    thanks,

    Housey

  2. #2
    Addicted Member
    Join Date
    Jul 2002
    Location
    Brussels, Belgium
    Posts
    139
    when you use conCurrent.Execute to open the recordset, you will get a read-only RS.
    Try to open it like this:

    rstCurrent.Open strSQL,conCurrent,adOpenStatic ,adLockOptimistic


    (in ASP don't forget to define the constants:
    Const adOpenStatic = 3
    Const adOpenDynamic = 2
    Const adLockReadOnly = 1
    Const adLockPessimistic = 2
    Const adLockOptimistic = 3
    Const adLockBatchOptimistic = 4
    etc.
    )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width