Freigeben über


CommitTrans (MDStore Interface)

HinweisHinweis

  Diese Funktion wird in der nächsten Version von Microsoft SQL Server entfernt. Verwenden Sie diese Funktion beim Entwickeln neuer Anwendungen nicht, und planen Sie so bald wie möglich das Ändern von Anwendungen, in denen es zurzeit verwendet wird.

The CommitTrans method of the MDStore interface commits a transaction previously initiated by the BeginTrans method on a Database object.

Applies To:clsDatabase

Syntax

object.CommitTrans    

Parameter

  • object
    The Database object associated with the transaction.

Hinweise

The CommitTrans method commits the transaction started with the BeginTrans method. The Rollback method can be used if the objects involved in the transaction are rolled back to the state prior to the execution of the BeginTrans method. If the CommitTrans method is called before the BeginTrans method is called, an error occurs.

The following code example begins a transaction on the FoodMart 2000 database, processes the Sales and Budget cubes, and commits the transaction.

    Dim dsoServer As New DSO.Server
    Dim dsoDB As DSO.MDStore
    Dim dsoCube As DSO.MDStore

    ' Connect to the local Analysis server.
    dsoServer.Connect "LocalHost"
    
    ' Open the FoodMart 2000 database.
    Set dsoDB = dsoServer.MDStores("FoodMart 2000")
    
    ' Begin a transaction on the database.
    dsoDB.BeginTrans
    
    ' Create a reference to the Sales cube.
    Set dsoCube = dsoDB.MDStores("Sales")
    
    ' Process the cube, refreshing data.
    dsoCube.Process processRefreshData
    
    'Create a reference to the Budget cube.
    Set dsoCube = dsoDB.MDStores("Budget")
    
    ' Process the cube completely.
    dsoCube.Process processFull
    
    ' Commit the transaction.
    dsoDB.CommitTrans