| Prasad 2005-04-25, 1:23 pm |
| I am getting a connection cannot be made error with the following code in C#.
I am using ADOMD.Net and here is the code. Please help.
using System;
using Microsoft.AnalysisServices.AdomdClient;
namespace TestMDXConn
{
class Test
{
[STAThread]
static void Main(string[] args)
{
const string data_source = "localhost";
const string provider = "msolap";
const string catalog = "FoodMart 2000";
string MDXStmt = "SELECT { { { [Time].&[1997].&[Q1],
[Time].&[1997].&[Q2], [Time].&[1997].&[Q3], [Time].&[1997].&[Q4] } *
{[Measures].[Units Ordered], [Measures].[Units Shipped]} } } ON COLUMNS , { {
{ [Store].[All Stores].CHILDREN } * { [Product].[All Products].CHILDREN } } }
ON ROWS From [Warehouse]";
string connectionString = "Data Source=" + data_source + ";Provider=" +
provider + ";Initial Catalog=" + catalog + ";";
AdomdConnection MDXConnection;
AdomdCommand MDXCommand;
/* ---- Open Connection ------ */
try
{
// Create a new AdomdConnection object, providing the connection string
MDXConnection = new AdomdConnection(conn
ectionString);
MDXConnection.Open();
}
catch(System.Exception e)
{
Console.WriteLine ("Message:{0}", e.Message);
Console.WriteLine ("Source:{0}", e.Source);
Console.WriteLine ("Stack Trace:{0}", e.StackTrace);
Console.WriteLine ("Inner Exception:{0}", e.InnerException);
throw new ApplicationException
("App Msg: An error occured while connecting");
}}
|