0
我有一个由MDX查询填充的DataTable。我想将该DataTable绑定到GridView并显示返回的所有数据。我的GridView的定义如下:GridView不显示DataTable中的所有列
<asp:GridView ID = "gvResults" runat="server" AutoGenerateColumns="true" />
MDX查询被称为如下:
DataTable mdxResults = new DataTable();
CellSet cellSet;
AdomdCommand command = new AdomdCommand();
strCommand = "SELECT NON EMPTY({[Measures].[Assets Distinct Count], [Measures].[Value]}) " +
"ON COLUMNS, NONEMPTY({[Organization].[Org Id].[Org Id]*[Location].[Loc Id].[Loc Id]}) " +
"ON ROWS FROM [database]"
command.Connection = _CurrentConnection;
command.CommandText = strCommand;
cellSet = command.ExecuteCellSet();
AdomdDataAdapter dataAdapter = new AdomdDataAdapter(command);
objDataAdapter.Fill(mdxResults);
,可以从MDX查询产生的DataTable的一个例子:
Organization Location Assets Value
Org A Los Angeles 12 320000
Org B San Jose 6 21000
资产和“值”是来自MDX查询的汇总度量值。
数据表随后绑定到GridView后重新命名列:
gvResults.DataSource = mdxResults;
gvResults.DataBind();
后我结合数据表仅列的子集在GridView显示。具体而言,将显示MDX查询中除Measure列外的所有列。
任何帮助,将不胜感激。
插入休息,例如DataTable中 – 2014-10-03 13:29:17
可以显示在您所呼叫的查询,然后结合的结果代码DataTable的GridView ..? – MethodMan 2014-10-03 13:29:39