2

I want to create an Analysis Services database, datasource and datasource view from c# code. Everything seems to be working fine until I add a mining structure and models and try to process the structure, then i get the following error:

Errors in the high-level relational engine. The data source view does not contain a definition for the 'dbo_Challenger201501TrainingAll' table or view. The Source property may not have been set.

The DSV is meant to contain the same info as a table in the Data Source.

This is the code with which i create the data set and DSV:

 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);

                Console.WriteLine(objEmpData.ToString());

                return objDataSet;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error in Creating a DataSourceView - FillDataSet. Error Message -> " + ex.Message);
                return null;
            }
        }


      private static object CreateDataSourceView(Microsoft.AnalysisServices.Database objDatabase, RelationalDataSource objDataSource, DataSet objDataSet, 
            string strCubeDataSourceViewName)
        {
            try
            {
                Console.WriteLine("Creating DataSourceView ...");
                DataSourceView objDataSourceView = new DataSourceView();
                //Add Data Source View to the Database.
                objDataSourceView = objDatabase.DataSourceViews.Add(strCubeDataSourceViewName);
                objDataSourceView.DataSourceID = objDataSource.ID;

                objDataSourceView.Schema = objDataSet;
                objDataSourceView.Update();

                return objDataSourceView;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error in Creating a DataSourceView - CreateDataSourceView. Error Message -> " + ex.Message);
                return null;
            }
        }

The code compiles and runs fine. can anyone see any reason why the DSV may not be created properly?

cmperezg
  • 145
  • 11

0 Answers0