Record retrieval problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Novice programmer

    Record retrieval problem

    I have the following code snippet:

    sql = "select * from customer where code = 'abc'"
    conn.BeginTrans
    With rs
    .Open sql, conn, adOpenDynamic, adLockPessimist ic,
    adCmdText
    If Not .EOF Then
    ' --- Force edit mode ---
    !Code = "def"
    Else
    ' --- Add key field(s) first ---
    .AddNew
    !Code = "def"
    End If
    End With

    and run the program twice to test the locking function.
    Suppose the 1st instance is editing the record 'abc'.
    When the 2nd instance tries to retrieve the same record at
    the Open statement, no error occurs and instead set the
    EOF property to True automatically, making the program
    thinks that there is no such record. Can I make the Open
    statement fails with error when there is another user
    editing
    the same record? Any help or suggestion will be
    appreciated.
    Thanks!



Working...