尝试显示我的类对象的rdlc报告
这是班级
public class BillInfo
{
public String Name { get; set; }
public String Date { get; set; }
public String splInstructions { get; set; }
public List<OrderItem> oItems { get; set; }
public String GrossTotal { get; set; }
public String DiscountAmount { get; set; }
public String NetTotal { get; set; }
}
public class OrderItem
{
public OrderItem() { }
public OrderItem(String sNo, String Qty, String Amt, String ttl)
{
this.SNo = sNo;
this.Quantity = Qty;
this.Amount = Amt;
this.Total = ttl;
}
public String SNo { get; set; }
public String Quantity { get; set; }
public String Amount { get; set; }
public String Total { get; set; }
}
现在我在数据源窗口中添加类 BillInfo 的数据源对象 并添加了一个报表查看器,现在当我尝试添加数据源vaue作为bill信息类的对象时,它给了我这个奇怪的错误
this.BillDataViewer.LocalReport.ReportPath = "C:/Users/Guest1/Desktop/Billinator/Billinator/MainReport.rdlc";
this.BillDataViewer.LocalReport.DataSources.Add(new ReportDataSource("BillInfo", MainForm.GetBillData()));
this.BillDataViewer.RefreshReport();
我添加数据源的第二行给了我这个错误
Value does not fall within the expected range.
“at Microsoft.Reporting.WinForms.ReportDataSource.set_Value(Object value)\ r \ n在Billinator.ReportViewer.ReportViewer_Load(Object sender,EventArgs e)中的C:\ Users \ Guest1 \ Desktop \ Billinator \ Billinator \ ReportViewer .cs:在System.Windows上的System.Windows.Forms.Form.OnLoad(EventArgs e)\ r \ n,在System.Windows的System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)\ r \ n中的第23行\ r \ n。在System.Windows.Forms.Control.WndProc(Message&amp; m)\ r \ n的System.Windows.Forms.Control.WmShowWindow(Message&amp; m)\ r \ n中的Forms.Control.CreateControl()\ r \ n系统.Windows.Forms.Control.ControlNativeWindow.WndProc(消息&amp; m)\ r \ n在System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,Int32 msg,IntPtr wparam,IntPtr lparam)“
请建议我哪里出错