下一版本的 Microsoft SQL Server 将删除该功能。请不要在新的开发工作中使用该功能,并尽快修改当前还在使用该功能的应用程序。

An object of the ClassType clsMiningModelRole provides a specific implementation of the Decision Support Objects (DSO) Role interface for data mining models. This object provides collections, methods, and properties through the Role interface.

You use objects of ClassType clsMiningModelRole to manage the set of users who can access a mining model and the manner in which they can access it. A mining model role has a name, a description, a parent object, a class type, a list of users, and a set of permissions. Each permission has a key and a corresponding permission expression.

You create roles at the database level (database roles) and then assign them to mining models (mining model roles) by adding them to the collection of roles associated with the mining model.

You can remove a database role by removing it from the database's collection of role objects. When you do so, the system automatically removes the corresponding mining model roles from the mining model's collection of role objects.

You can remove a mining model role by removing it from the mining model's collection of role objects. When you do so, the corresponding database role is not affected. However, the definition of the mining model role remains in effect until you update or process the cube.


If dsoDb.DataSources("DMTest") Is Nothing Then
    Set dsoDs = dsoDb.DataSources.AddNew("DMTest")
    dsoDs.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;data source=d:dmtest2.mdb"
End If
'Create a new mining model role.
If dsoDb.Roles("DMDev") Is Nothing Then
    Set dsoRole = dsoDb.Roles.AddNew("DMDev")
    dsoRole.UsersList = "DOMAIN\SomeUser"
End If

'Check to see whether the mining model exists.
If Not dsoDb.MiningModels("CustSalesRel") Is Nothing Then
    'Delete it if it does.
    dsoDb.MiningModels.Remove "CustSalesRel"
End If
'Now create the model afresh.
Set dsoDmm = dsoDb.MiningModels.AddNew("CustSalesRel")
'Add a new datasource for the model
dsoDmm.DataSources.AddNew "DMTest"
'Add a data mining role to the new mining model.
Set dsoRole = dsoDmm.Roles.AddNew("DMDev")