dbTalk Databases Forums  

Cannot make a connection to the server

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


Discuss Cannot make a connection to the server in the microsoft.public.sqlserver.olap forum.



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

Default Cannot make a connection to the server - 04-25-2005 , 01:19 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(connectionString);
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");
}}

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.