Bonjour,
Je cherche un code C# pour exécuter et analyser le résultat de requêtes XMLA sur un CUBE SQL SERVER 2008.
Actuellement j’utilise le module AdomdConnection pour de connecter à mon CUBE mais je n’arrive pas à faire exécuter du XMLA.
Mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 string strCnx = "Data Source=SERVEUR;Initial catalog=Adventure Works"; AdomdConnection cnx = new AdomdConnection(strCnx); cnx.Open(); CubeDef cube = cnx.Cubes["Adventure Works"]; AdomdCommand cmd = new AdomdCommand(); cmd.Connection = cnx; //cmd.CommandText = "SELECT {[Meaesures].[Reseller Sales Amount]} on 0 FROM [Adventure Works]"; Les requete MBR sexécute correctement. cmd.CommandText = "<Discover xmlns='urn:schemas-microsoft-com:xml-analysis'><RequestType>MDSCHEMA_MEMBERS</RequestType><Restrictions><RestrictionList><CUBE_NAME>Adventure Works</CUBE_NAME><HIERARCHY_UNIQUE_NAME>[Customer].[City]</HIERARCHY_UNIQUE_NAME></RestrictionList></Restrictions><Properties><PropertyList><Format>Tabular</Format><AxisFormat>TupleFormat</AxisFormat></PropertyList></Properties></Discover>"; CellSet cellset = cmd.ExecuteCellSet();
CellSet cellset = cmd.ExecuteCellSet(); //ERREUR LORS DE L’EXECUTION: L'élément Discover ligne 7, colonne 25 (espace de noms urn:schemas-microsoft-com:xml-analysis) ne peut pas apparaître dans Envelope/Body/Execute/Command.
Merci d'avance
Partager