Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Reportviewer重新排序数据集?_C#_Reportviewer - Fatal编程技术网

C# Reportviewer重新排序数据集?

C# Reportviewer重新排序数据集?,c#,reportviewer,C#,Reportviewer,我正在将实体框架数据集传递给RDLC,输出的顺序与我期望的不一致。下面是我的代码,我希望输出按CarName列排序,但它不是按该顺序呈现的。我错过了什么 BF_Model db = new BF_Model(); IQueryable<vwAllExportLog> dsEDIReports_EF_vwAllExportLog; dsEDIReports_EF_vwAllExportLog = from c

我正在将实体框架数据集传递给RDLC,输出的顺序与我期望的不一致。下面是我的代码,我希望输出按CarName列排序,但它不是按该顺序呈现的。我错过了什么

               BF_Model db = new BF_Model();

           IQueryable<vwAllExportLog> dsEDIReports_EF_vwAllExportLog;

           dsEDIReports_EF_vwAllExportLog = from c in db.vwAllExportLog
                                            let mydate2 = new DateTime(2014, 7, 17)
                                            where c.Production == true
                                                    && c.RunDate >= mydate2
                                            orderby c.CarName, c.CltName, c.RunDate
                                            select c;

           //provide local report information to viewer
           reportViewer1.Reset();
           reportViewer1.LocalReport.ReportPath = @"D:\Development\EDIReports_EF\EDIReports_EF\Reports\ExportsGroupedByCarrier.rdlc";
           reportViewer1.LocalReport.DataSources.Clear();

           reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("dsEDIReports_EF_vwAllExportLog", dsEDIReports_EF_vwAllExportLog));

           reportViewer1.LocalReport.Refresh();

           //load report viewer
           reportViewer1.RefreshReport();

那最后一行是干什么的?据我所知,使用report viewer,您只需要调用reportviewer.LocalReport.Refresh,您已经在这样做了。我甚至没有一个来自查看器控件的刷新报告。这是正在进行的自定义操作吗?最后一行似乎是必需的。如果没有报表查看器,报表将根本无法呈现。报表查看器将保持空白。我使用了一个在互联网上找到的例子作为指导,不幸的是,上面的例子没有说明你为什么需要做这个或那个。我发现我可以不刷新上一次,但不能刷新最后一次。