hello,
Here are some examples of using GetSchemaDataSet.
Using "ole-db like" overloads: when you specify schema by guid and an object
array containing restrictions. Restriction mapping is done by position in
the array. The code might look like this:
// ole db - like approach
// schema specified by guid;
// restrictions matched by position;
// assuming 'con' is an opened connection
object[] rest = new object[]
{
"Adventure Works DW", // CATALOG_NAME
null, // SCHEMA_NAME
"Adventure Works", // CUBE_NAME
null, // DIMENSION_ NAME
null, // DIMENSION_UNIQUE_NAME
null // CUBE_SOURCE
};
DataTable dimensions =
con.GetSchemaDataSet(
AdomdSchemaGuid.Dimensions,
rest).Tables[0];
int columnIndex = dimensions.Columns.IndexOf("DIMENSION_NAME");
foreach (DataRow row in dimensions.Rows)
{
Debug.WriteLine(row[columnIndex].ToString());
}
Another way to do the same schema retrieval: you can specify schema by name
instead of guid and you can also use AdomdRestrictionCollection for
specifying restrictions (restrictions are matched by name). In this case the
code might look somewhat like this:
// another way - schema specified by name;
// restriction matching done by name;
// using restrictions collection
// assuming 'con' is an opened connection
AdomdRestrictionCollection restrictions =
new AdomdRestrictionCollection();
restrictions.Add("CATALOG_NAME", "Adventure Works DW");
restrictions.Add("CUBE_NAME", "Adventure Works");
DataTable dimensions =
con.GetSchemaDataSet(
"MDSCHEMA_DIMENSIONS",
restrictions).Tables[0];
int columnIndex = dimensions.Columns.IndexOf("DIMENSION_NAME");
foreach (DataRow row in dimensions.Rows)
{
Debug.WriteLine(row[columnIndex].ToString());
}
hope this helps,
-- mary
--
This posting is provided "AS IS" with no warranties, and confers no rights.
--
"G_NoSpam" <gilly1409 (AT) hotmail (DOT) com> wrote
Quote:
Hi
Can someone point me to an example of how to retrieve a list of a
dimensions or named sets for a cube into a dataset via the
GetSchemaDataSet function?
I've thought
AdomdRestrictionCollection restrictions = new
AdomdRestrictionCollection();
restrictions.Add("CUBE_NAME", Name);
DataSet dsDimensions=
mcnADOMD.GetSchemaDataSet(AdomdSchemaGuid.Dimensio ns, restrictions);
but apparently I need an objet array rather than an
AdomdRestrictionCollection
any samples would be great
tia |