LockObject (Command Interface)

ms133887.note(zh-cn,SQL.90).gif注意:
  下一版本的 Microsoft SQL Server 将删除该功能。请不要在新的开发工作中使用该功能,并尽快修改当前还在使用该功能的应用程序。

The LockObject method of the Command interface locks an object to prevent multiple users from concurrently changing the object.

Applies To: clsDatabaseCommand

语法

object.LockObject(ByVal LockType As OlapLockTypes, ByVal LockDescription As String)

参数

  • object
    The object to lock.
  • LockType
    One of the lock types of the OlapLockTypes enumeration. For more information, see OlapLockTypes.
  • LockDescription
    A string that contains a description of the lock. This argument is available to other applications attempting to obtain a lock.

备注

Of the four types of locks defined by the OlapLockTypes enumeration, only olapLockRead and olapLockWrite apply to the Command interface.

Lock type Applies to

olapLockRead

Applications can read the properties of the command object from the repository but cannot make changes until the lock is released (this includes the application that created the lock).

olapLockWrite

The application that created the lock can modify the object's properties and save them in the repository using the Update method. Other applications cannot read the properties of the object until the lock is released.

For more information about object locking, see LockObject.

示例

The following example locks a command object so that it can be modified. It then unlocks the object and updates the repository information for that object.

'Assume a command object (dsoCmd) exists.
dsoCmd.LockObect OlapLockRead, "Updating command, please wait."
' (Insert code to change command object here.)
dsoCmd.Update
dsoCmd.UnlockObject

请参阅

参考

Command Interface

帮助和信息

获取 SQL Server 2005 帮助