homeshopper
asked on
'Microsoft.AnalysisServices.AdomdClient.Dimension' does not contain a definition
I am getting the following errors:
'Microsoft.AnalysisService s.AdomdCli ent.Dimens ion' does not contain a definition for 'ID'
and no extension method 'ID' accepting a first argument of type 'Microsoft.AnalysisService s.AdomdCli ent.Dimens ion'
could be found (are you missing a using directive or an assembly reference?)
Error Line 451 66
'Microsoft.AnalysisService s.AdomdCli ent.Dimens ion' does not contain a definition for 'KeyAttribute'
and no extension method 'KeyAttribute' accepting a first argument of type 'Microsoft.AnalysisService s.AdomdCli ent.Dimens ion'
could be found (are you missing a using directive or an assembly reference?)
Error Line 455 66
The code below is where the error is coming from:
For clarity below is the complete code:
'Microsoft.AnalysisService
and no extension method 'ID' accepting a first argument of type 'Microsoft.AnalysisService
could be found (are you missing a using directive or an assembly reference?)
Error Line 451 66
'Microsoft.AnalysisService
and no extension method 'KeyAttribute' accepting a first argument of type 'Microsoft.AnalysisService
could be found (are you missing a using directive or an assembly reference?)
Error Line 455 66
The code below is where the error is coming from:
private static void GenerateCube(Microsoft.AnalysisServices.Cube objCube, Dimension objDimension, Microsoft.AnalysisServices.MeasureGroup objMeasureGroup, string strFactTableName, string strTableKey)
{
try
{
Microsoft.AnalysisServices.CubeDimension objCubeDim = new Microsoft.AnalysisServices.CubeDimension();
Microsoft.AnalysisServices.RegularMeasureGroupDimension objRegMGDim = new Microsoft.AnalysisServices.RegularMeasureGroupDimension();
Microsoft.AnalysisServices.MeasureGroupAttribute objMGA = new Microsoft.AnalysisServices.MeasureGroupAttribute();
//Add Dimension to the Cube
objCubeDim = objCube.Dimensions.Add(objDimension.ID);// Error Here Line 451
//Use Regular Relationship Between Dimension and FactTable Measure Group
objRegMGDim = objMeasureGroup.Dimensions.Add(objCubeDim.ID);
//Link TableKey in DimensionTable with TableKey in FactTable Measure Group
objMGA = objRegMGDim.Attributes.Add(objDimension.KeyAttribute.ID);// Error Here Line 455
objMGA.Type = Microsoft.AnalysisServices.MeasureGroupAttributeType.Granularity;
objMGA.KeyColumns.Add(strFactTableName, strTableKey, OleDbType.Integer);
}
catch (Exception ex)
{
HttpContext.Current.Response.Write("Error in Creating the Cube, MeasureGroup, Measure, and Partition Objects - GenerateCube. Error Message -> " + ex.Message);
}
}
Thanks in advance for any help givenFor clarity below is the complete code:
using System;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Linq;
using System.Data.Common;
using System.Web.Configuration;
using System.Diagnostics;
using System.Text;
using System.IO;
using System.Collections;
using System.Xml;
using System.Net;
using System.Text.RegularExpressions;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
using System.ComponentModel;
using System.Drawing;
using System.Web.SessionState;
//using Microsoft.SqlServer.Management.Common;
//using Microsoft.SqlServer.Management.Smo;
//using Microsoft.SqlServer.Management.Sdk.Sfc;
//using Microsoft.AnalysisServices;
//using Microsoft.AnalysisServices.AdomdServer;
//using Microsoft.AnalysisServices.AdomdClient;
//using Microsoft.AnalysisServices.Server;
using Microsoft.AnalysisServices.AdomdClient;
public partial class aaaMisc0 : System.Web.UI.Page
{
public string page_Renamed;
public int j;
public int i;
public string connectionString;
protected string[] strArrayDB33 = new string[31];
protected string[] strArrayDetail33 = new string[31];
protected string[] strArrayTable33 = new string[31];
public int intstrDetail22;
public int intstrDetail55;
public string strSession2;
public string DataBaseLabelappTest;
public string TableLabelappTest;
public string strIntappTest;
protected int intDetail22;
public string IsConnectionInfoSetappTest;
public string ProviderLabelappTest;
public string detailsLabel2appTest;
public string detailsLabelappTest;
public string strDB22;
public string strDBT22;
public ArrayList ParameterArray = new ArrayList();
public static DataTable Table = new DataTable();
public string odbName;
public string lblXMLFile;
public DropDownList ddl;
public aaaMisc0()
{
Page.Init += new System.EventHandler(Page_Init);
}
protected void Page_Init(object sender, EventArgs e)
{
if (Page.User.Identity.IsAuthenticated)
{
Page.ViewStateUserKey = Page.Session.SessionID;
}
InitializeComponent();
//BuildDynamicDropDown();
}// End Page_Init
protected void Page_Load(object sender, System.EventArgs e)
{
Session["strArrayPageName"] = "aaaMisc";Session["IsConnectionInfoSet"] = false;
HttpContext.Current.Response.Write(MyAppCSDefault0.divStart2);
try
{
if (Session["strConnection"] == null){DataServer.Text = "<font color='red'>" + "!-Connected!!" + "</font>";}else{DataServer.Text = "Connected!!";}
if (!IsPostBack)
{
HttpContext.Current.Response.Write("<span id='spanpost1' style='position:absolute;top:-12px;'>" + "!IsPB:" + "</span>");
intstrDetail55 = intstrDetail55 + 1;Session["strPage"] = intstrDetail55;
if (Session["strConnection"] != null)
{
BindData8();BindData9();
//<!-- Start Page Content -->
//<!-- End Page Content -->
//CreateTemplatedGridView();
}
//Sprocs.DataBind();//UpdateParameterDisplay();
//<!-- Start Page Content -->
//<!-- End Page Content -->
}// End !IsPostBack
else
{
HttpContext.Current.Response.Write("<span id='spanpost1' style='position:absolute;top:-12px;'>" + "IsPB:" + "</span>");
intstrDetail55 = intstrDetail55 + 1;Session["strPage"] = intstrDetail55;
if (Session["strConnection"] != null)
{
//<!-- Start Page Content -->
//<!-- End Page Content -->
//CreateTemplatedGridView();
}
}// End else
} // End try
catch (Exception ex)
{
errorLabel4.Text = "<font color='red'>" + "err:111E:PL:" + "</font>" + ex.ToString();
} // End catch
if (Page.IsPostBack && System.Convert.ToBoolean(Session["IsConnectionInfoSet"]) == true)
{
//<!-- Start Page Content -->
//<!-- End Page Content -->
//CreateTemplatedGridView();
}
HttpContext.Current.Response.Write(MyAppCSDefault0.divEnd);
}// End Page_Load
private void InitializeComponent()
{
}
protected void Logout_Click(object sender, System.EventArgs e)
{
Session["strConnection"] = null;Session["IsConnectionInfoSet"] = false;
} // End Logout_Click
protected void LoginButton_Click(object sender, System.EventArgs e)
{
Response.Redirect("../../modules/create_cams_managers/connect0.aspx?MainMenuId=0&SubMenuId=0&db22=AdminDB2&dt22=AdminTable2&intDetail22=0&strD22=False&page=0");
} // End LoginButton_Click
public void BindData8()
{
try
{
strDB22 = Request["db22"];strDBT22 = Request["dt22"];
string connectionString = System.Convert.ToString(Session["strConnection"]) + " Initial Catalog=" + strDB22 + ";";
intstrDetail55 = System.Convert.ToInt32(Session["strPage"]);
if (intstrDetail55 >= 0){}else{Session["strPage"] = 0;}
string server_tb = (string)Session["Server"];string user_tb = (string)Session["UserName"];string pswrd_tb = (string)Session["Password"];string database_tb = (string)Session["DatabaseSelected"];string table_tb = (string)Session["TableSelected"];
string connstr = "@" + Session["strConnection"] + "Initial Catalog=" + strDB22 + ";";string[] str1 = connstr.Split(';');
server_tb = str1[0].Split('=')[1];user_tb = str1[1].Split('=')[1];pswrd_tb = str1[2].Split('=')[1];database_tb = str1[3].Split('=')[1];table_tb = strDBT22;
Session["Server"] = server_tb;Session["UserName"] = user_tb;Session["Password"] = pswrd_tb;Session["DatabaseSelected"] = database_tb;Session["TableSelected"] = table_tb;
}
catch (Exception ex)
{
errorLabel4.Text = "<font color='red'>" + "err:150E:BD8:" + "</font>" + ex.ToString();
} // End catch
}// End BindData8
public void BindData9()
{
try
{
string server_tb = (string)Session["Server"];string user_tb = (string)Session["UserName"];string pswrd_tb = (string)Session["Password"];string database_tb = (string)Session["DatabaseSelected"];string table_tb = (string)Session["TableSelected"];
string connectionString = System.Convert.ToString(Session["strConnection"]);
lblTable.Text = "<font color='Silver'>" + "Ln:159T:BD9:" + connectionString + "#" + "</font>" + "<font color='green'>" + " tbl:" + "</font>" + "<font color='Silver'>" + table_tb + "#" + "</font>";
errorLabel4.Text = "<font color='red'>" + "msg:160T:BD9:" + "</font>" + "message:=>ex.ToString()";
HttpContext.Current.Response.Write("<br/><br/> Yes:");
//<!-- Start Page Content -->
HttpContext.Current.Response.Write("Cube creation process started.");
HttpContext.Current.Response.Write("");
string strDBServerName = "LocalHost";
string strProviderName = "msolap";
string strFactTableName = "FactResellerSales";
string strDBName = "AdventureWorksDW2008";
string strCubeDBName = "OLAPDB";
string strCubeDataSourceName = "OLAPDS";
string strCubeDataSourceViewName = "OLAPDSView";
int intDimensionTableCount = 6;
string[,] strTableNamesAndKeys = { { "DimCurrency", "CurrencyKey", "FactResellerSales", "CurrencyKey" },
{ "DimEmployee", "EmployeeKey", "FactResellerSales", "EmployeeKey" },
{ "DimProduct", "ProductKey", "FactResellerSales", "ProductKey" },
{ "DimPromotion", "PromotionKey", "FactResellerSales", "PromotionKey" },
{ "DimReseller", "ResellerKey", "FactResellerSales", "ResellerKey" },
{ "DimSalesTerritory", "SalesTerritoryKey", "FactResellerSales", "SalesTerritoryKey" },
};
Microsoft.AnalysisServices.Server objServer = new Microsoft.AnalysisServices.Server();
Microsoft.AnalysisServices.Database objDatabase = new Microsoft.AnalysisServices.Database();
Microsoft.AnalysisServices.RelationalDataSource objDataSource = new Microsoft.AnalysisServices.RelationalDataSource();
Microsoft.AnalysisServices.DataSourceView objDataSourceView = new Microsoft.AnalysisServices.DataSourceView();
DataSet objDataSet = new DataSet();
Dimension[] objDimensions = new Dimension[intDimensionTableCount];
//Connecting to the Analysis Services.
objServer = (Microsoft.AnalysisServices.Server)ConnectAnalysisServices(strDBServerName, strProviderName);
//Creating a Database.
objDatabase = (Microsoft.AnalysisServices.Database)CreateDatabase(objServer, strCubeDBName);
//Creating a DataSource.
objDataSource = (Microsoft.AnalysisServices.RelationalDataSource)CreateDataSource(objServer, objDatabase, strCubeDataSourceName, strDBServerName, strDBName);
//Creating a DataSourceView.
objDataSet = (DataSet)GenerateDWSchema(strDBServerName, strDBName, strFactTableName, strTableNamesAndKeys, intDimensionTableCount);
objDataSourceView = (Microsoft.AnalysisServices.DataSourceView)CreateDataSourceView(objDatabase, objDataSource, objDataSet, strCubeDataSourceViewName);
//Creating the Dimension, Attribute, Hierarchy, and MemberProperty Objects.
objDimensions = (Dimension[])CreateDimension(objDatabase, objDataSourceView, strTableNamesAndKeys, intDimensionTableCount);
//Creating the Cube, MeasureGroup, Measure, and Partition Objects.
CreateCube(objDatabase, objDataSourceView, objDataSource, objDimensions, strFactTableName, strTableNamesAndKeys, intDimensionTableCount);
objDatabase.Process(Microsoft.AnalysisServices.ProcessType.ProcessFull);
HttpContext.Current.Response.Write("Cube created successfully.");
//<!-- End Page Content -->
errorLabel4.Text = "<font color='red'>" + "msg:165T:BD9:" + "</font>" + "Olap Connection Ok";
}
catch (Exception ex)
{
errorLabel4.Text = "<font color='red'>" + "err:169E:BD9:" + "</font>" + ex.ToString();
} // End catch
HttpContext.Current.Response.Write("");
HttpContext.Current.Response.Write("Press any key to exit.");
Console.ReadLine();
}// End BindData9
private static object ConnectAnalysisServices(string strDBServerName, string strProviderName)
{
try
{
HttpContext.Current.Response.Write("Connecting to the Analysis Services ...");
Microsoft.AnalysisServices.Server objServer = new Microsoft.AnalysisServices.Server();
string strConnection = "Data Source=" + strDBServerName + ";Provider=" + strProviderName + ";";
//Disconnect from current connection if it's currently connected.
if (objServer.Connected)
objServer.Disconnect();
else
objServer.Connect(strConnection);
return objServer;
}
catch (Exception ex)
{
HttpContext.Current.Response.Write("Error in Connecting to the Analysis Services. Error Message -> " + ex.Message);
return null;
}
}
private static object CreateDatabase(Microsoft.AnalysisServices.Server objServer, string strCubeDBName)
{
try
{
HttpContext.Current.Response.Write("Creating a Database ...");
Microsoft.AnalysisServices.Database objDatabase = new Microsoft.AnalysisServices.Database();
//Add Database to the Analysis Services.
objDatabase = objServer.Databases.Add(objServer.Databases.GetNewName(strCubeDBName));
//Save Database to the Analysis Services.
objDatabase.Update();
return objDatabase;
}
catch (Exception ex)
{
HttpContext.Current.Response.Write("Error in Creating a Database. Error Message -> " + ex.Message);
return null;
}
}
private static object CreateDataSource(Microsoft.AnalysisServices.Server objServer, Microsoft.AnalysisServices.Database objDatabase, string strCubeDataSourceName, string strDBServerName, string strDBName)
{
try
{
HttpContext.Current.Response.Write("Creating a DataSource ...");
Microsoft.AnalysisServices.RelationalDataSource objDataSource = new Microsoft.AnalysisServices.RelationalDataSource();
//Add Data Source to the Database.
objDataSource = objDatabase.DataSources.Add(objServer.Databases.GetNewName(strCubeDataSourceName));
//objDataSource.ConnectionString = "Provider=SQLOLEDB.1;Initial Catalog=AdventureWorksDW2008;Data Source=LocalHost;Integrated Security=True;";
objDataSource.ConnectionString = "Provider=SQLNCLI.1; Data Source=" + strDBServerName + "; Initial Catalog=" + strDBName + "; Integrated Security=SSPI;";
objDataSource.Update();
return objDataSource;
}
catch (Exception ex)
{
HttpContext.Current.Response.Write("Error in Creating a DataSource. Error Message -> " + ex.Message);
return null;
}
}
private static object GenerateDWSchema(string strDBServerName, string strDBName, string strFactTableName, string[,] strTableNamesAndKeys, int intDimensionTableCount)
{
try
{
HttpContext.Current.Response.Write("Creating a DataSourceView ...");
//Create the connection string.
string conxString = "Data Source=" + strDBServerName + "; Initial Catalog=" + strDBName + "; Integrated Security=True;";
//Create the SqlConnection.
SqlConnection objConnection = new SqlConnection(conxString);
DataSet objDataSet = new DataSet();
//Add FactTable in DataSet.
objDataSet = (DataSet)FillDataSet(objConnection, objDataSet, strFactTableName);
//Add table in DataSet and Relation between them.
for (int i = 0; i < intDimensionTableCount; i++)
{
//Retrieve table's schema and assign the table's schema to the DataSet.
//Add primary key to the schema according to the primary key in the tables.
objDataSet = (DataSet)FillDataSet(objConnection, objDataSet, strTableNamesAndKeys[i, 0]);
objDataSet = (DataSet)AddDataTableRelation(objDataSet, strTableNamesAndKeys[i, 0], strTableNamesAndKeys[i, 1], strTableNamesAndKeys[i, 2], strTableNamesAndKeys[i, 3]);
}
return objDataSet;
}
catch (Exception ex)
{
HttpContext.Current.Response.Write("Error in Creating a DataSourceView - GenerateDWSchema. Error Message -> " + ex.Message);
return null;
}
}
private static object FillDataSet(SqlConnection objConnection, DataSet objDataSet, string strTableName)
{
try
{
string strCommand = "Select * from " + strTableName;
SqlDataAdapter objEmpData = new SqlDataAdapter(strCommand, objConnection);
objEmpData.MissingSchemaAction = MissingSchemaAction.AddWithKey;
objEmpData.FillSchema(objDataSet, SchemaType.Source, strTableName);
return objDataSet;
}
catch (Exception ex)
{
HttpContext.Current.Response.Write("Error in Creating a DataSourceView - FillDataSet. Error Message -> " + ex.Message);
return null;
}
}
private static object AddDataTableRelation(DataSet objDataSet, string strParentTableName, string strParentTableKey, string strChildTableName, string strChildTableKey)
{
try
{
objDataSet.Relations.Add(strChildTableName + "_" + strParentTableName + "_FK", objDataSet.Tables[strParentTableName].Columns[strParentTableKey], objDataSet.Tables[strChildTableName].Columns[strChildTableKey]);
return objDataSet;
}
catch (Exception ex)
{
HttpContext.Current.Response.Write("Error in Creating a DataSourceView - AddDataTableRelation. Error Message -> " + ex.Message);
return null;
}
}
private static object CreateDataSourceView(Microsoft.AnalysisServices.Database objDatabase, Microsoft.AnalysisServices.RelationalDataSource objDataSource, DataSet objDataSet, string strCubeDataSourceViewName)
{
try
{
Microsoft.AnalysisServices.DataSourceView objDataSourceView = new Microsoft.AnalysisServices.DataSourceView();
//Add Data Source View to the Database.
objDataSourceView = objDatabase.DataSourceViews.Add(objDatabase.DataSourceViews.GetNewName(strCubeDataSourceViewName));
objDataSourceView.DataSourceID = objDataSource.ID;
objDataSourceView.Schema = objDataSet;
objDataSourceView.Update();
return objDataSourceView;
}
catch (Exception ex)
{
HttpContext.Current.Response.Write("Error in Creating a DataSourceView - CreateDataSourceView. Error Message -> " + ex.Message);
return null;
}
}
private static object[] CreateDimension(Microsoft.AnalysisServices.Database objDatabase, Microsoft.AnalysisServices.DataSourceView objDataSourceView, string[,] strTableNamesAndKeys, int intDimensionTableCount)
{
try
{
HttpContext.Current.Response.Write("Creating the Dimension, Attribute, Hierarchy, and MemberProperty Objects ...");
Dimension[] objDimensions = new Dimension[intDimensionTableCount];
for (int i = 0; i < intDimensionTableCount; i++)
{
objDimensions[i] = (Dimension)GenerateDimension(objDatabase, objDataSourceView, strTableNamesAndKeys[i, 0], strTableNamesAndKeys[i, 1]);
}
////Add Hierarchy and Level
//Hierarchy objHierarchy = objDimension.Hierarchies.Add("ProductByCategory");
//objHierarchy.Levels.Add("Category").SourceAttributeID = objCatKeyAttribute.ID;
//objHierarchy.Levels.Add("Product").SourceAttributeID = objProdKeyAttribute.ID;
////Add Member Property
////objProdKeyAttribute.AttributeRelationships.Add(objProdDescAttribute.ID);
//objDimension.Update();
return objDimensions;
}
catch (Exception ex)
{
HttpContext.Current.Response.Write("Error in Creating the Dimension, Attribute, Hierarchy, and MemberProperty Objects. Error Message -> " + ex.Message);
return null;
}
}
private static object GenerateDimension(Microsoft.AnalysisServices.Database objDatabase, Microsoft.AnalysisServices.DataSourceView objDataSourceView, string strTableName, string strTableKeyName)
{
try
{
Microsoft.AnalysisServices.Dimension objDimension = new Microsoft.AnalysisServices.Dimension();
//Add Dimension to the Database
objDimension = objDatabase.Dimensions.Add(strTableName);
objDimension.Source = new Microsoft.AnalysisServices.DataSourceViewBinding(objDataSourceView.ID);
Microsoft.AnalysisServices.DimensionAttributeCollection objDimensionAttributesColl = objDimension.Attributes;
//Add Dimension Attributes
Microsoft.AnalysisServices.DimensionAttribute objAttribute = objDimensionAttributesColl.Add(strTableKeyName);
//Set Attribute usage and source
objAttribute.Usage = Microsoft.AnalysisServices.AttributeUsage.Key;
objAttribute.KeyColumns.Add(strTableName, strTableKeyName, OleDbType.Integer);
objDimension.Update();
return objDimension;
}
catch (Exception ex)
{
HttpContext.Current.Response.Write("Error in Creating the Dimension, Attribute, Hierarchy, and MemberProperty Objects - GenerateDimension. Error Message -> " + ex.Message);
return null;
}
}
private static void CreateCube(Microsoft.AnalysisServices.Database objDatabase, Microsoft.AnalysisServices.DataSourceView objDataSourceView, Microsoft.AnalysisServices.RelationalDataSource objDataSource, Dimension[] objDimensions, string strFactTableName, string[,] strTableNamesAndKeys, int intDimensionTableCount)
{
try
{
HttpContext.Current.Response.Write("Creating the Cube, MeasureGroup, Measure, and Partition Objects ...");
Microsoft.AnalysisServices.Cube objCube = new Microsoft.AnalysisServices.Cube();
Microsoft.AnalysisServices.Measure objSales = new Microsoft.AnalysisServices.Measure();
Microsoft.AnalysisServices.Measure objQuantity = new Microsoft.AnalysisServices.Measure();
Microsoft.AnalysisServices.MdxScript objTotal = new Microsoft.AnalysisServices.MdxScript();
String strScript;
Microsoft.AnalysisServices.Partition objPartition = new Microsoft.AnalysisServices.Partition();
Microsoft.AnalysisServices.Command objCommand = new Microsoft.AnalysisServices.Command();
//Add Cube to the Database and set Cube source to the Data Source View
objCube = objDatabase.Cubes.Add("SampleCube");
objCube.Source = new Microsoft.AnalysisServices.DataSourceViewBinding(objDataSourceView.ID);
//Add Measure Group to the Cube
//MeasureGroup objMeasureGroup = objCube.MeasureGroups.Add("FactSales");
Microsoft.AnalysisServices.MeasureGroup objMeasureGroup = objCube.MeasureGroups.Add(strFactTableName);
//Add Measure to the Measure Group and set Measure source
objSales = objMeasureGroup.Measures.Add("Amount");
objSales.Source = new Microsoft.AnalysisServices.DataItem(strFactTableName, "SalesAmount", OleDbType.Currency);
objQuantity = objMeasureGroup.Measures.Add("Quantity");
objQuantity.Source = new Microsoft.AnalysisServices.DataItem(strFactTableName, "OrderQuantity", OleDbType.Integer);
////Calculated Member Definition
//strScript = "Calculated; Create Member CurrentCube.[Measures].[Total] As [Measures].[Quantity] * [Measures].[Amount]";
////Add Calculated Member
//objTotal.Name = "Total Sales";
//objCommand.Text = strScript;
//objTotal.Commands.Add(objCommand);
//objCube.MdxScripts.Add(objTotal);
for (int i = 0; i < intDimensionTableCount; i++)
{
GenerateCube(objCube, objDimensions[i], objMeasureGroup, strFactTableName, strTableNamesAndKeys[i, 3]);
}
objPartition = objMeasureGroup.Partitions.Add(strFactTableName);
objPartition.Source = new Microsoft.AnalysisServices.TableBinding(objDataSource.ID, "dbo", strFactTableName);
objPartition.ProcessingMode = Microsoft.AnalysisServices.ProcessingMode.Regular;
objPartition.StorageMode = Microsoft.AnalysisServices.StorageMode.Molap;
//Save Cube and all major objects to the Analysis Services
objCube.Update(Microsoft.AnalysisServices.UpdateOptions.ExpandFull);
}
catch (Exception ex)
{
HttpContext.Current.Response.Write("Error in Creating the Cube, MeasureGroup, Measure, and Partition Objects. Error Message -> " + ex.Message);
}
}
private static void GenerateCube(Microsoft.AnalysisServices.Cube objCube, Dimension objDimension, Microsoft.AnalysisServices.MeasureGroup objMeasureGroup, string strFactTableName, string strTableKey)
{
try
{
Microsoft.AnalysisServices.CubeDimension objCubeDim = new Microsoft.AnalysisServices.CubeDimension();
Microsoft.AnalysisServices.RegularMeasureGroupDimension objRegMGDim = new Microsoft.AnalysisServices.RegularMeasureGroupDimension();
Microsoft.AnalysisServices.MeasureGroupAttribute objMGA = new Microsoft.AnalysisServices.MeasureGroupAttribute();
//Add Dimension to the Cube
objCubeDim = objCube.Dimensions.Add(objDimension.ID);// Error Here Line 451
//Use Regular Relationship Between Dimension and FactTable Measure Group
objRegMGDim = objMeasureGroup.Dimensions.Add(objCubeDim.ID);
//Link TableKey in DimensionTable with TableKey in FactTable Measure Group
objMGA = objRegMGDim.Attributes.Add(objDimension.KeyAttribute.ID);// Error Here Line 455
objMGA.Type = Microsoft.AnalysisServices.MeasureGroupAttributeType.Granularity;
objMGA.KeyColumns.Add(strFactTableName, strTableKey, OleDbType.Integer);
}
catch (Exception ex)
{
HttpContext.Current.Response.Write("Error in Creating the Cube, MeasureGroup, Measure, and Partition Objects - GenerateCube. Error Message -> " + ex.Message);
}
}
}// End class
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I had a lot of 'using class' statements which was causing a conflict.
I have now been able to get all my code to work.