dbTalk Databases Forums  

adomd.net - GetSchemaDataSet ??

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss adomd.net - GetSchemaDataSet ?? in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
G_NoSpam
 
Posts: n/a

Default adomd.net - GetSchemaDataSet ?? - 07-05-2006 , 05:43 AM






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



Reply With Quote
  #2  
Old   
Mary Potapova [MS]
 
Posts: n/a

Default Re: adomd.net - GetSchemaDataSet ?? - 07-11-2006 , 06:38 PM






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





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.