Wrox Home  
Search P2P Archive for: Go

  Return to Index  

activex_data_objects thread: Locking Issues


Message #1 by "enZo :-\)" <enzaux@g...> on Tue, 3 Sep 2002 14:12:53 +0800
   Hello guys!  I was really bothered by this locking on ADO.  From my code below, why is
it my second connection to the db can update the record eventhough on my 1st connection
to the db is still using the record?  Is there something wrong with the way I connect to 
the db?  How do really this LockTypeEnum types works?  I've tried using two different
db connections (rs2 using another connection object) but still no locking occurs.

   strSQL = "SELECT * FROM tblBooklets WHERE BookletNo = 1"
   Conn2DB ' Procedure connecting to db 

' ** 1st connection **  
   Set rs = New ADODB.Recordset
   rs.Open strSQL, gDBConn, adOpenKeyset, adLockPessimistic
   
     rs!TellerID = 2
   
' ** 2nd connection **
   Set rs2 = New ADODB.Recordset
   rs2.Open strSQL, gDBConn, adOpenKeyset, adLockPessimistic
   
      With rs2
        !TellerID = 3
        .Update
      End With

 rs.Update
 
 rs.Close
 Set rs = Nothing
 rs2.Close
 Set rs2 = Nothing

 DisConnDB ' procedure disconnecting from db

Thanks,

Enzo
YahooID: onestepcloser2insanity


  Return to Index