Server dsoServer = new ServerClass();
dsoServer.Connect( «LocalHost» );
// Find the FoodMart 2000 Sales cube.
MDStore dsoDatabase = (MDStore) dsoServer.MDStores.Item(«FoodMart 2000»);
MDStore dsoCube = (MDStore) dsoDatabase.MDStores.Item(«Sales»);
// Display all commands already associated with cube.
//foreach (Command dsoCommand in dsoCube.Commands)
//{
// MessageBox.Show( dsoCommand.Statement );
//}
// Create a new calculated member on the Sales cube.
Command dsoCreateMemberCommand = (Command)
dsoCube.Commands.AddNew(«MyCalcMeasure», SubClassTypes.sbclsRegular);
dsoCreateMemberCommand.CommandType = CommandTypes.cmdCreateMember;
dsoCreateMemberCommand.Statement = «CREATE MEMBER [Measures].[Five] as ?5?»;
// Be sure to save the changes to the cube.
dsoCube.Update();
// Close down your connections.
dsoServer.CloseServer();
Marshal.ReleaseComObject(dsoServer);
dsoServer = null;

Поделитесь материалом с коллегами и друзьями