Microsoft KB Archive/246360

= PRB: Space in ConnectString Does Not Allow Pessimistic Locking =

Article ID: 246360

Article Last Modified on 12/3/2003

-

APPLIES TO


 * Microsoft Data Access Components 2.0
 * Microsoft Data Access Components 2.1
 * Microsoft Data Access Components 2.1 Service Pack 2
 * Microsoft Data Access Components 2.5
 * Microsoft Data Access Components 2.6
 * Microsoft Data Access Components 2.7

-



This article was previously published under Q246360



SYMPTOMS
Placing a space in the ConnectString after the keyword Provider will not allow the use of pessimistic locking (adLockPessimistic).



RESOLUTION
Remove the space from the ConnectString.



STATUS
This behavior is by design.



MORE INFORMATION
This only happens using the SQLOLEDB, Jet 3.51 and Jet 4.0 OLEDB Providers with Server-Side cursors and Pessimistic Locking.

Steps to Reproduce Behavior
 Start a new Visual Basic Standard EXE project. Form1 is added by default. From the Project menu, click References, and select the Microsoft ActiveX Data Objects.  Place the following code in the Code Window of Form1. Private Sub Form_Load

Dim cn As ADODB.Connection Dim rs As ADODB.Recordset

set cn = New ADODB.Connection set rs = New ADODB.Recordset

cn.Open "Provider =Microsoft.jet.oledb.3.51;Data Source=c:\Program Files\Microsoft Visual Studio\VB98\nwind.mdb"   'Causes Problem 'cn.open "Provider=Microsoft.jet.oledb.3.51;Data Source=c:\Program Files\Microsoft Visual Studio\VB98\nwind.mdb"    'Does not cause the problem

With rs   .CursorLocation = adUseServer .CursorType = adOpenKeyset .LockType = adLockPessimistic .Open "Select * from Customers", cn End With

Debug.Print rs.CursorLocation   'Should be 2 Debug.Print rs.CursorType       'Should be 1 Debug.Print rs.LockType         'Should be 2 but you get 4 End Sub  Run the Project.

Result: You receive a BatchOptimistic (4) instead of a Pessimistic lock (2).

Keywords: kbfix kbprb KB246360

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.