Example #1
0
 private void SearchFiltersButton_Click(object sender, EventArgs e)
 {
     // First clear the existing members
     AvailableFiltersListBox.Items.Clear();
     try
     {
         foreach (object o in SearchFiltersListBox.SelectedItems)
         {
             List <string> members = CubeQueries.getMembersByHierarchy(o.ToString(), Datasource1Textbox.Text, Catalog1Textbox.Text, Cube1Textbox.Text);
             foreach (string s in members)
             {
                 AvailableFiltersListBox.Items.Add(s);
             }
         }
     }
     catch (ArgumentException ae)
     {
         if (ae.Message.Contains("A data source must be specified in the connection string."))
         {
             MessageBox.Show("Empty connection information entered.\n"
                             + ae.Message,
                             "Connection Error.",
                             MessageBoxButtons.OK,
                             MessageBoxIcon.Error);
         }
         else
         {
             throw ae;
         }
     }
     catch (Microsoft.AnalysisServices.AdomdClient.AdomdConnectionException ace)
     {
         if (ace.Message.Contains("A connection cannot be made."))
         {
             MessageBox.Show("Unable to connect to server. Check your connection or connection information.\n"
                             + ace.Message,
                             "Connection Error.",
                             MessageBoxButtons.OK,
                             MessageBoxIcon.Error);
         }
         else
         {
             throw ace;
         }
     }
     catch (Microsoft.AnalysisServices.AdomdClient.AdomdErrorResponseException aere)
     {
         if (aere.Message.Contains("Either the user,") &&
             aere.Message.Contains("does not have access to the ") &&
             aere.Message.Contains("database, or the database does not exist."))
         {
             MessageBox.Show("Unable to connect to find catalog.\n"
                             + aere.Message,
                             "Connection Error.",
                             MessageBoxButtons.OK,
                             MessageBoxIcon.Error);
         }
         else
         {
             throw aere;
         }
     }
 }
Example #2
0
        private void GetCubeInfoButton_Click(object sender, EventArgs e)
        {
            try
            {
                List <string> measureNames   = CubeQueries.getAllMeasures(Datasource1Textbox.Text, Catalog1Textbox.Text, Cube1Textbox.Text);
                List <string> attributeNames = CubeQueries.getAllAttributes(Datasource1Textbox.Text, Catalog1Textbox.Text, Cube1Textbox.Text);
                List <string> searchFilters  = CubeQueries.getVisibleHierarchiesByCube(Datasource1Textbox.Text, Catalog1Textbox.Text, Cube1Textbox.Text);

                clearAvailableListboxes();

                foreach (string s in measureNames)
                {
                    AvailableMeasuresListBox.Items.Add(s);
                }

                foreach (string s in attributeNames)
                {
                    AvailableAttributesListbox.Items.Add(s);
                }

                foreach (string s in searchFilters)
                {
                    SearchFiltersListBox.Items.Add(s);
                    DateAttributeCombobox.Items.Add(s);
                }
            }
            catch (ArgumentException ae)
            {
                if (ae.Message.Contains("A data source must be specified in the connection string."))
                {
                    MessageBox.Show("Empty connection information entered.\n"
                                    + ae.Message,
                                    "Connection Error.",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
                else
                {
                    throw ae;
                }
            }
            catch (Microsoft.AnalysisServices.AdomdClient.AdomdConnectionException ace)
            {
                if (ace.Message.Contains("A connection cannot be made."))
                {
                    MessageBox.Show("Unable to connect to server. Check your connection or connection information.\n"
                                    + ace.Message,
                                    "Connection Error.",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
                else
                {
                    throw ace;
                }
            }
            catch (Microsoft.AnalysisServices.AdomdClient.AdomdErrorResponseException aere)
            {
                if (aere.Message.Contains("Either the user,") &&
                    aere.Message.Contains("does not have access to the ") &&
                    aere.Message.Contains("database, or the database does not exist."))
                {
                    MessageBox.Show("Unable to connect to find catalog.\n"
                                    + aere.Message,
                                    "Connection Error.",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
                else
                {
                    throw aere;
                }
            }
        }