ReportViewer Render method error with object datasource

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

We have a report class that retrieves the data from multiple business classes.
When we get to the Render function, the application errors out with the
following error (inner Exception):


{"A data source instance has not been supplied for the data source
\"Company_Processor_InvoiceInfo\"."}

I have been trying to figure this out, but no success:

The following is part of my code:

// global variables
private List<InvoiceInfo> m_InvoiceInfo; // single item
private List<InvoiceLineItems> m_InvoiceLineItems;
private List<InvoicePackagedLineItems> m_InvoicePackagedLineItems;


ReportViewer rptViewer = new ReportViewer();
rptViewer.ProcessingMode = ProcessingMode.Local;
rptViewer.LocalReport.ReportPath = "SDInvoice.rdlc";
rptViewer.LocalReport.DataSources.Clear();
rptViewer.LocalReport.DataSources.Add(new
ReportDataSource("InvoiceInfo", m_InvoiceInfo));
rptViewer.LocalReport.DataSources.Add(new
ReportDataSource("InvoiceLineItems", m_InvoiceLineItems));
rptViewer.LocalReport.DataSources.Add(new
ReportDataSource("InvoicePackagedLineItems", m_InvoicePackagedLineItems));

// Application Crashed on Next Line
byte[] data = rptViewer.LocalReport.Render("PDF", null, out
mimeType, out encoding, out extension, out streamids, out warnings);

string FileName = Path + "\\Invoice.pdf";
FileStream fs = new FileStream(FileName, FileMode.Create);
fs.Write(data, 0, data.Length);
fs.Close();
 
Back
Top