System.Text.StringBuilder result = new System.Text.StringBuilder(); using (AdomdConnection conn = new AdomdConnection("Data Source=localhost;Initial Catalog=Adventure Works DW;Provider=MSOLAP.2;Integrated Security=SSPI;Persist Security Info=False;")) { conn.Open(); foreach (CubeDef cube in conn.Cubes) { if (cube.Name.StartsWith("$")) continue; if (cube.Name == "Adventure Works") { result.AppendLine(cube.Name); foreach (Microsoft.AnalysisServices.AdomdClient.Dimension dim in cube.Dimensions) { result.Append("\t"); result.AppendLine(dim.Name); } foreach (Microsoft.AnalysisServices.AdomdClient.NamedSet set in cube.NamedSets) { result.Append("\t"); result.AppendLine(set.Name); } } } conn.Close(); } Server objServer = new Server(); string strConnection = "Data Source=localhost;Initial Catalog=Adventure Works DW;Provider=MSOLAP.2;Integrated Security=SSPI;Persist Security Info=False;"; if (objServer.Connected) objServer.Disconnect(); objServer.Connect(strConnection); Database db = objServer.Databases["Adventure Works DW"]; for (int i=0;i<db.Roles.Count;i++) { Role role = db.Roles[i]; result.Append("\t"); result.AppendLine(role.Name); } Cube cube1 = db.Cubes.FindByName("Adventure Works"); foreach (CubeDimensionPermission cubeper in cube1.CubePermissions) { foreach (AttributePermission attrperm in cubeper.AttributePermissions) { result.Append("\t"); result.AppendLine(attrperm.AllowedSet[0].ToString()); } } MessageBox.Show(result.ToString()); |
Friday, December 31, 2010
ADOMD fetches Cube Details
Using ADOMD to fetch details of dimension, roles and Allowed Set in permission
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.