Development Environments
Nota
Esta característica se quitará en la versión siguiente de Microsoft SQL Server. No utilice esta característica en nuevos trabajos de desarrollo y modifique lo antes posible las aplicaciones que actualmente la utilizan.
You can use Decision Support Objects (DSO) with any language that supports COM Automation, such as Microsoft® Visual Basic®, Microsoft Visual Basic Scripting Edition, or Microsoft Visual C++®.
Visual Basic
You can use the DSO library in Visual Basic simply by setting the Decision Support Objects library as a project reference.
Example
Dim dsoServer As New DSO.Server
dsoServer.Connect "LocalHost"
Setting Program References
To use the DSO library in a Visual Basic application, add it as a reference to the project. On the Project menu, click References, and then select Microsoft Decision Support Objects.
Visual Basic Scripting Edition
Visual Basic Scripting Edition programmers can use DSO by using the CreateObject method. This method can be used to create any needed object in the DSO libraries.
Example
The following example creates a DSO.Server object:
Dim dsoServer
Set dsoServer = CreateObject("DSO.Server")
dsoServer.Connect "LocalHost"
In order to support scripting, the DSO Database, Cube, Partition, and Aggregation objects implement the MDStore class interface as well as their own class interface; this is the default interface used for MDStores collections of DSO objects. The following code example illustrates the retrieval of a database from a server using the MDStores collection:
Dim dsoDatabase
Set dsoDatabase = dsoServer.MDStores(1)
The ClassType and SubClassType properties of the MDStore interface allow for class determination. If the class-specific interface for a particular object is needed, first use the CreateObject command to create an instance of the object, then set it to the required object in the MDStores collection. This is demonstrated in the following code example:
Dim dsoServer
Dim dsoDatabase
Set dsoServer = CreateObject("DSO.Server")
dsoServer.Connect "LocalHost"
Set dsoDatabase = CreateObject("DSO.Database")
Set dsoDatabase = dsoServer.MDStores(1)
Advertencia |
---|
It is recommended that, for any DSO object supporting the MDStore interface, the class-specific interface not be used. |