Quantcast
Channel: SQL Server Analysis Services Forum
Viewing all articles
Browse latest Browse all 2472

How can i display column names Dynamically ?

$
0
0

Hi All,

string conString = "Provider=MSOLAP.4;Initial Catalog=Adventure Works DW 2008R2;Data             

               Source=Servername";
           string cmdQuery = txtQuery.Text;
   AdomdConnection con = new AdomdConnection(conString);
           AdomdCommand cmd = new AdomdCommand(cmdQuery,con);
           con.Open();
           DataTable dt2 = new DataTable();
            AdomdDataAdapter da = new AdomdDataAdapter(cmd);
             da.Fill(dt2);
            int numberColumns = dt2.Columns.Count - 1;
            dt2.Columns[1].ColumnName = "Sales Amount";
            dt2.Columns[0].ColumnName = "Product";
            GridView2.DataSource = dt2;
            GridView2.DataBind();

Here i am doing hardcode for the column name...... when i change the query i want to display column name Dynamically in my FrontEnd.

Can any one Guide me the way How to Approach it?

Regards  

JHKiran


Viewing all articles
Browse latest Browse all 2472

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>