-----------------------------------------------------------

New Message on MumbaiUserGroup

-----------------------------------------------------------
From: chandramukhi_mug
Message 4 in Discussion

Code to experiemnt the BEGIN / COMMIT problem


Option Explicit
Dim adoDcn As New ADODB.Connection
Dim adoRs As New ADODB.Recordset

Dim adoDcn2 As New ADODB.Connection
Dim adoRs2 As New ADODB.Recordset

Dim QryStr As String
Dim level As Integer

Private Sub Command1_Click()
adoDcn.ConnectionTimeout = 0
'adoDcn.ConnectionString = "DSN=FNOCASH;UID=sa;PWD=;"
'adoDcn.ConnectionString = "Provider=sqloledb;" & _
      "Data Source=nt3;Initial Catalog=cashfno;User Id=sa;Password=;"
''adoDcn.ConnectionString = "driver={SQL 
Server};server=nt3;uid=sa;pwd=;database=cashfno"

adoDcn.ConnectionString = "driver={SQL Server};server=nt3;uid=sa;pwd=;database=pubs"


'Various modes were tried
adoDcn.Mode = adModeShareExclusive


'Various isolation level were tried.

adoDcn2.IsolationLevel = adXactReadCommitted
'adoDcn.IsolationLevel = adXactIsolated
'adoDcn.IsolationLevel = adXactCursorStability
'adoDcn.IsolationLevel = adXactReadUncommitted
'adoDcn.IsolationLevel = adXactBrowse
'adoDcn.IsolationLevel = adXactSerializable


adoDcn2.IsolationLevel = adXactReadCommitted
'adoDcn2.IsolationLevel = adXactIsolated
'adoDcn2.IsolationLevel = adXactCursorStability
'adoDcn2.IsolationLevel = adXactReadUncommitted
'adoDcn2.IsolationLevel = adXactBrowse
'adoDcn2.IsolationLevel = adXactSerializable

adoDcn2.ConnectionTimeout = 0
'adoDcn2.ConnectionString = "DSN=FNOCASH;UID=sa;PWD=;"
'adoDcn2.ConnectionString = "Provider=sqloledb;" & _
      "Data Source=nt3;Initial Catalog=cashfno;User Id=sa;Password=;"
''adoDcn2.ConnectionString = "driver={SQL 
Server};server=nt3;uid=sa;pwd=;database=cashfno"
adoDcn2.ConnectionString = "driver={SQL Server};server=nt3;uid=sa;pwd=;database=pubs"

'MsgBox adoDcn2.Attributes

'= adModeShareDenyRead
adoDcn2.Mode = adModeShareDenyWrite

adoDcn.Open
adoDcn2.Open

'level = adoDcn.BeginTrans()
'MsgBox level


adoDcn.BeginTrans


''QryStr = "Update Taccbal set acb_dCloseBal = 6000 where acb_lSrNo=56629 and 
acb_lentity=3 and acb_lFyrSrNo=4"
QryStr = "Update publishers set city = 'Mumbai - 3' where pub_id = '0736'"

'You can try changing Mumbai - 1 to -2 , -3 etc. for each iteration while testing this 
form.


adoDcn.Execute QryStr

'adoDcn.RollbackTrans
'adoDcn.CommitTrans


'QryStr = "Select * from Taccbal where acb_lSrNo=56629 and acb_lentity=3 and 
acb_lFyrSrNo=4"
''QryStr = "Select * from Taccbal with (nolock) where acb_lSrNo=56629 and 
acb_lentity=3 and acb_lFyrSrNo=4"


QryStr = "Select * from publishers with (nolock) where pub_id = '0736'"
'Note above has with (nolock)
'If the same is removed, I get timeout error.
'You might say that that is how it should be ?
'What I am expecting is old value
'since it is quite possible that the user is adding many records and if the
'records added after BeginTrans but before CommitTrans are made available to other 
users,
'the the reports like Ledger / Trial balance / Day books etc. will be wrong since only 
half
'of the vocuhers will be shown to the other users.
'QryStr = "Select * from publishers where pub_id = '0736'"


Set adoRs2 = Nothing


'adoRs2.Open QryStr, adoDcn2, adOpenDynamic, adLockReadOnly
'If adoOpenDynamic is used, I do not get the record. SO no current record error

adoRs2.Open QryStr, adoDcn2, adOpenForwardOnly, adLockReadOnly

'MsgBox adoRs2.Fields(0).Properties(0).Name

If Not adoRs2.EOF Then
    MsgBox CStr(adoRs2!city)
End If

End Sub
'*********** end ***********



-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/MumbaiUserGroup/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to