Crystal reports CrystalReports数据字段均为空

Crystal reports CrystalReports数据字段均为空,crystal-reports,Crystal Reports,我使用的是VS community 2017和CrystalReports的sp25 我制作了一个程序,可以将列表对象中的数据显示到CrystalReport窗口中。下面是列表类: using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Agrico

我使用的是VS community 2017和CrystalReports的sp25

我制作了一个程序,可以将列表对象中的数据显示到CrystalReport窗口中。下面是列表类:

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AgricoveBilling
{
    public class reporter : IEnumerable<reporter>
    {
        public string InvoiceNo { get; set; }
        public string InvoiceDt { get; set; }
        public string DueDt { get; set; }
        public string BillToName { get; set; }
        public string BillToAdd { get; set; }

        public string ItemID1Name { get; set; }
        public decimal ItemID1Price { get; set; }
        public decimal ItemID1Qty { get; set; }
        public decimal ItemID1Total { get; set; }
        public string ItemID2Name { get; set; }
        public decimal ItemID2Price { get; set; }
        public decimal ItemID2Qty { get; set; }
        public decimal ItemID2Total { get; set; }
        public string ItemID3Name { get; set; }
        public decimal ItemID3Price { get; set; }
        public decimal ItemID3Qty { get; set; }
        public decimal ItemID3Total { get; set; }
        public string ItemID4Name { get; set; }
        public decimal ItemID4Price { get; set; }
        public decimal ItemID4Qty { get; set; }
        public decimal ItemID4Total { get; set; }
        public string ItemID5Name { get; set; }
        public decimal ItemID5Price { get; set; }
        public decimal ItemID5Qty { get; set; }
        public decimal ItemID5Total { get; set; }
        public string ItemID6Name { get; set; }
        public decimal ItemID6Price { get; set; }
        public decimal ItemID6Qty { get; set; }
        public decimal ItemID6Total { get; set; }
        public string ItemID7Name { get; set; }
        public decimal ItemID7Price { get; set; }
        public decimal ItemID7Qty { get; set; }
        public decimal ItemID7Total { get; set; }
        public string ItemID8Name { get; set; }
        public decimal ItemID8Price { get; set; }
        public decimal ItemID8Qty { get; set; }
        public decimal ItemID8Total { get; set; }
        public string ItemID9Name { get; set; }
        public decimal ItemID9Price { get; set; }
        public decimal ItemID9Qty { get; set; }
        public decimal ItemID9Total { get; set; }
        public string ItemID10Name { get; set; }
        public decimal ItemID10Price { get; set; }
        public decimal ItemID10Qty { get; set; }
        public decimal ItemID10Total { get; set; }
        public string ItemID11Name { get; set; }
        public decimal ItemID11Price { get; set; }
        public decimal ItemID11Qty { get; set; }
        public decimal ItemID11Total { get; set; }

        public decimal Subtotal { get; set; }
        public string DiscountType { get; set; }
        public decimal DiscountValue { get; set; }
        public decimal SubtotalLessDiscount { get; set; }
        public decimal TaxRate { get; set; }
        public decimal Totaltax { get; set; }
        public decimal GrossTotal { get; set; }
        public decimal Paid { get; set; }
        public decimal Due { get; set; }

        public IEnumerator<reporter> GetEnumerator()
        {
            throw new NotImplementedException();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            throw new NotImplementedException();
        }
    }
}
使用系统;
使用系统集合;
使用System.Collections.Generic;
使用System.Linq;
使用系统文本;
使用System.Threading.Tasks;
命名空间计费
{
公共课记者:我是数不清的
{
公共字符串InvoiceNo{get;set;}
公共字符串InvoiceDt{get;set;}
公共字符串DueDt{get;set;}
公共字符串BillToName{get;set;}
公共字符串BillToAdd{get;set;}
公共字符串ItemID1Name{get;set;}
公共十进制项ID1price{get;set;}
公共十进制项ID1QTY{get;set;}
公共十进制项ID1Total{get;set;}
公共字符串ItemID2Name{get;set;}
公共十进制项ID2price{get;set;}
公共十进制项ID2QTY{get;set;}
公共十进制项ID2Total{get;set;}
公共字符串ItemID3Name{get;set;}
公共十进制项ID3price{get;set;}
公共十进制项ID3QTY{get;set;}
公共十进制项ID3Total{get;set;}
公共字符串ItemID4Name{get;set;}
公共十进制项ID4price{get;set;}
公共十进制项ID4QTY{get;set;}
公共十进制项ID4Total{get;set;}
公共字符串ItemID5Name{get;set;}
公共十进制项ID5price{get;set;}
公共十进制项ID5QTY{get;set;}
公共十进制项ID5Total{get;set;}
公共字符串ItemID6Name{get;set;}
公共十进制项ID6price{get;set;}
公共十进制项ID6QTY{get;set;}
公共十进制项ID6Total{get;set;}
公共字符串ItemID7Name{get;set;}
公共十进制项ID7price{get;set;}
公共十进制项ID7QTY{get;set;}
公共十进制项ID7Total{get;set;}
公共字符串ItemID8Name{get;set;}
公共十进制项ID8price{get;set;}
公共十进制项ID8QTY{get;set;}
公共十进制项ID8Total{get;set;}
公共字符串ItemID9Name{get;set;}
公共十进制项ID9price{get;set;}
公共十进制项ID9QTY{get;set;}
公共十进制项ID9Total{get;set;}
公共字符串ItemID10Name{get;set;}
公共十进制项ID10price{get;set;}
公共十进制项ID10QTY{get;set;}
公共十进制项ID10Total{get;set;}
公共字符串ItemID11Name{get;set;}
公共十进制项ID11price{get;set;}
公共十进制项ID11QTY{get;set;}
公共十进制项ID11Total{get;set;}
公共十进制小计{get;set;}
公共字符串折扣类型{get;set;}
公共十进制折扣值{get;set;}
公共十进制小计折扣{get;set;}
公共十进制税率{get;set;}
公共十进制Totaltax{get;set;}
公共十进制GrossTotal{get;set;}
公共{get;set;}
公共十进制到期日{get;set;}
公共IEnumerator GetEnumerator()
{
抛出新的NotImplementedException();
}
IEnumerator IEnumerable.GetEnumerator()
{
抛出新的NotImplementedException();
}
}
}
我已将reporter类设置为数据源

嵌入CrystalReportViewer的表单具有以下代码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;

namespace AgricoveBilling
{
    public partial class Printpreview : Form
    {
        List<reporter> rep;
        public Printpreview(List<reporter> r)
        {
            InitializeComponent();
            rep = r;      
        }

        private void Printpreview_Load(object sender, EventArgs e)
        {
            ReportDocument rpt = new ReportDocument();
            rpt.Load(@"..\printform.rpt");
            rpt.SetDataSource(rep);
            print_crystalreport.ReportSource = rpt;            
            print_crystalreport.Zoom(55);
            print_crystalreport.Refresh();

        }
    }
} 
使用系统;
使用System.Collections.Generic;
使用系统组件模型;
使用系统数据;
使用系统图;
使用System.Linq;
使用系统文本;
使用System.Threading.Tasks;
使用System.Windows.Forms;
使用CrystalDecisions.CrystalReports.Engine;
命名空间计费
{
公共部分类Printpreview:表单
{
名单代表;
公共打印预览(列表r)
{
初始化组件();
rep=r;
}
私有void打印预览加载(对象发送方,事件参数e)
{
ReportDocument rpt=新的ReportDocument();
加载(@“.\printform.rpt”);
rpt.SetDataSource(rep);
print_crystalreport.ReportSource=rpt;
打印crystalreport.Zoom(55);
print_crystalreport.Refresh();
}
}
} 
没有错误。我使用QuickWatch检查了所有C#对象是否正确加载。我知道正在加载正确的rpt文件,因为报告上的文本对象是正确的

但报告中绝对没有数据

老实说,我不知道CrystalReports如何将正确的字段和正确的数据绑定在一起。我是不是应该在什么地方写些代码

我尝试将iEnumerable更改为常规类,但在SetDataSoruce期间,我被告知该对象是无效的数据源。我试图手动使用SetParameterValue,但这样会出现Badindex错误。我确保参数名是正确的