title: Adding Adomd parameters programmatically C#
body: <p>Afternoon all.</p>
  
  <p>I'm building a web app and I'm attempting to pull through some data from an SSAS cube.</p>
  
  <p>I have the following MDX I would like to replicate in c# but with adding a few parameters i.e. two parameteres, one for company 123 and another for location 1:</p>
  
  <pre><code>@"SELECT NON EMPTY([Dim Unit].[All Units].[Category Group Name]) ON COLUMNS
                      FROM [Info]
                      WHERE ([Dim Company].[All Companies].&amp;[123], 
                      [Dim Location].[All Locations].&amp;[123]&amp;[1])"; 
  </code></pre>
  
  <p>Now, I can get this up and running with one parameter:</p>
  
  <pre><code> AdomdCommand cmdPDC = conPDC.CreateCommand();
          cmdPDC.CommandText = "SELECT [Dim Unit].[All Units].[Category Group Name].Members ON 0 FROM [Info] WHERE (StrToMember(@P1)";
  
          string companyid = "123";
  
          string sP1 = "[Dim Company].&amp;" + company;
  
      cmdPDC.Parameters.Add(new AdomdParameter("P1", sP1));
  </code></pre>
  
  <p>But how do I then implement a second parameter, for example, if I wanted to stick a parameter in for location? I was thinking along the lines ofbelow but I can't get the little sod to work:</p>
  
  <pre><code>AdomdCommand cmdPDC = conPDC.CreateCommand();
          cmdPDC.CommandText = "SELECT [Dim Unit].[All Units].[Category Group Name].Members ON 0 FROM [Info] WHERE (StrToMember(@P1)," + "(StrToMember(@P2))";
  
          string companyid = "123";
          string locationid = "1";
  
          string sP1 = "[Dim Company].&amp;" + company;
          string sP2 = "[Dim Location].&amp;" + company + "&amp;" + location;
  
          cmdPDC.Parameters.Add(new AdomdParameter("P1", sP1));
          cmdPDC.Parameters.Add(new AdomdParameter("P2", sP2));
  </code></pre>
  
  <p>Any help or advice gratefully received.</p>