Databases Reference
In-Depth Information
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using Microsoft.AnalysisServices.AdomdClient;
namespace AdomdParametricQuery
{
partial class Form1: Form
{
private AdomdConnection con = new AdomdConnection();
private TupleCollection productFamiliesTuples = null;
public Form1()
{
InitializeComponent();
//During initialization of the form, we create a connection
//to the server.
this.con.ConnectionString = “Datasource=localhost; Initial Catalog=
Foodmart 2008”;
this.con.Open();
//Fill out the combo box with all the product families.
PopulateProductFamilies();
}
//Fill in the combo box with all the possible product families. In order
//to do this, generate the following MDX request to send to the server:
//SELECT [Product].[Products].[Product Family].members ON COLUMNS
FROM [Warehouse and Sales]
private void PopulateProductFamilies()
{
AdomdCommand command = this.con.CreateComman();
command.CommandText =
“SELECT [Product].[Products].[Product Family].members
ON COLUMNS FROM [Warehouse and Sales]”;
CellSet cellSet = command.ExecuteCellSet();
productFamiliesTuples = cellSet.Axes[0].Set.Tuples;
foreach(Tuple tuple in productFamiliesTuples)
{
productFamiliesBox1.Items.Add(tuple.Members[0].Caption);
}
productFamiliesBox1.SelectedIndex = 0;
return;
}
Search WWH ::




Custom Search