PRB: Data Environment: Error Setting Lock Type (189853)



The information in this article applies to:

  • Microsoft Visual Basic Enterprise Edition for Windows 6.0
  • ActiveX Data Objects (ADO) 2.1
  • ActiveX Data Objects (ADO) 2.1 SP2
  • ActiveX Data Objects (ADO) 2.5
  • ActiveX Data Objects (ADO) 2.6
  • ActiveX Data Objects (ADO) 2.7

This article was previously published under Q189853

SYMPTOMS

When trying to use Pessimistic locking and Client Cursors, Visual Basic generates the following error message:
An invalid value was entered for 'Lock Type'.
Under Microsoft Data Access Components (MDAC) version 2.5, the error message appears as
Invalid property value.

CAUSE

Pessimistic locking is not available with Client cursors in ADO or the Data Environment.

RESOLUTION

Change your cursor to Server-Side or change your lock type.

STATUS

This behavior is by design.

MORE INFORMATION

Note that Pessimistic locking on server-side cursors must be supported by the driver/provider in order to use this functionality in ADO. SQL Server and Access drivers and providers have this functionality whereas Oracle does not.

Under MDAC version 2.5 or later, you cannot set the locktype to Pessimistic when the cursor location is set to aduseclient. The above error will be returned immediately.

Steps to Reproduce Behavior

  1. Run Visual Basic 6.0 and open a new Standard EXE Project. Form1 is created by default. Add a DataEnvironment to the project.
  2. In the Data Environment Window, right-click the default Connection1 object, choose Properties from the shortcut menu, choose the Connection tab, and then select the Use Connection String option.
  3. Enter your Connection String to a valid data source. This example will use SQL Server's pubs database and the authors table, such as:
          CONNECTIONSOURCE="PROVIDER=sqloledb;DATA" & _
                           "SOURCE=<server_name>;" & _
                           "INITIAL CATALOG=pubs;" & _
                           "USER ID=<uid>;PASSWORD=<pwd>;"
    
    					
  4. Click OK.
  5. Click the Add a Command object to open a table.
  6. Set the Command Name to Authors.
  7. Change the Database Object to Table.
  8. From the list of tables, select Authors.
  9. Change the locktype to Pessimistic. The location is aduseclient by default.
Result:
Microsoft Data Environment Designer
An invalid value was entered for 'Lock Type'

Modification Type:MajorLast Reviewed:8/23/2001
Keywords:kbDatabase kbDataBinding kbDSupport kbprb KB189853