none
Using ReportDataSource with linq to sql datacontext class RRS feed

  • Question

  • I'm trying to use a datacontext class (from Linq to SQL) as the source of data to programatically create a new ReportDataSource, and open the report. This code is in the Load event of the form with the report viewer.

    The report Data Source Name ("VendorInvoiceDCClass") and the Data Source Instance ("VendorsBindingSource") are shown here exactly as they are shown under Choose Data Sources in the ReportViewer Tasks pop-up window. The datacontext has a single class named Vendors, which is created from a SQL table of the same name. The table does have data in it.

    The result I get is a report which shows only the header values of the fields, but no data. I've been trying to get this to work for about 2 days, and have searched every web page I can find, but no solution.

        Me.ReportViewer.Reset()
       
    Me.ReportViewer.ProcessingMode = ProcessingMode.Local
       
    Me.ReportViewer.LocalReport.DataSources.Clear()

       
    Me.ReportViewer.LocalReport.ReportEmbeddedResource = "VendorInvoicesReport.VendorsList.rdlc"
       
    Me.ReportViewer.LocalReport.DataSources.Add(New ReportDataSource("VendorInvoicesDCClass", VendorsBindingSource))
       
    Me.ReportViewer.RefreshReport()

    DanW52
    • Moved by Mike Feng Monday, August 22, 2011 6:22 PM Report (From:Visual Basic General)
    Friday, August 19, 2011 4:08 PM

All replies