数据表的回发问题

时间:2018-07-05 10:00:26

标签: c# visual-studio devexpress mdx

我遇到了带有自定义mdx查询的数据表回发的问题。

当我不回发并更改页面时,数据不会返回。

下面是我使用的代码

if (!IsPostBack)
            {
            Comments = GetComments();
            ASPxPivotGrid1.BeginUpdate();
            try
            {

                String connectionString = "provider=MSOLAP;data source=finainfordv.northeurope.cloudapp.azure.com;initial catalog=Lempo_Test;user id=mariam.ahmed.ext@hmdglobal.com;password=Mariasharapova5";

                String query = "drillthrough select from [LEMPO] where ( [Measures].[Group Curr Amt Original] ) return MemberValue([$Plan].[Plan Name]), MemberValue([$Time].[Fis Qtr]),MemberValue([$Geography].[Geography]), MemberValue([$Time].[Fis Yr Month SKey]), MemberValue([$Geography].[CountryName]), MemberValue([$Account].[Account Code And Name]), MemberValue([$Organisation].[Cost Center Code and Name]), MemberValue([$Nari].[Nari Cd]), MemberValue([$Company].[Legal Company]), [Transactions].[Group Curr Amt Original]";
                using (OleDbConnection connection = new OleDbConnection(connectionString))
                {
                    connection.Open();
                    using ( command = connection.CreateCommand())
                    {
                        //ASPxPivotGrid1. = "3600";
                        command.CommandText = query;
                        ASPxPivotGrid1.DataSource = ReadQueryResult(command);


                    }
                }}

    protected System.Data.DataTable ReadQueryResult(OleDbCommand command)
    {
        System.Data.DataTable table = new System.Data.DataTable();
        try
        {
            ////ASPxPivotGrid1.RetrieveFields();
            //ASPxPivotGrid1.Fields["[$Organisation].[Cost Center Code and Name]"].Area = DevExpress.XtraPivotGrid.PivotArea.RowArea;
            command.CommandTimeout = 3600000;
            using (OleDbDataReader reader = command.ExecuteReader())
            {
                for (int i = 0; i < reader.FieldCount; i++)
                    table.Columns.Add(reader.GetName(i), reader.GetFieldType(i));
                object[] values = new object[reader.FieldCount];
                while (reader.Read())
                {
                    reader.GetValues(values);
                    table.Rows.Add(values);
                }

            }

        }

        catch (Exception ex1)
        {
            Console.WriteLine(ex1.Message);
        }

但是当我移至下一页时,数据未加载

我正在使用ivotgrid,但是当我移至第二页时,在透视网格中看不到数据。

0 个答案:

没有答案