locked
Problem with Dataset passin in a RDLC Report in Visual Basic RRS feed

  • Question

  • I am here to solve a strange problem i am facing.... I am developing a project, and at this point i design the reports... In a windows form i put a Report Viewer, in which i associate a RDLC Report file. In the form i am preparing a Dataset who contains a Table When finish the prparation of the Dataset, i am assign the Datasource for the Report as follow :

    With Me.ReportViewer1.LocalReport
            .DataSources.Clear()
            .DataSources.Add(New Microsoft.Reporting.WinForms.ReportDataSource("EveryVehicle1", ReportDataSet.Tables("Report")))
        End With

    the Data set i have prepare is the ReportDataSet After that, i have Add a new Dataset in my project, named "Every_VehicleDataset.xsd" There i add a Table named "EveryVehicle1" containg the same things as "Report" Table.

    After that i add to the RDLC File a Dataset following thw wizard and choosing the table from "Every_VehicleDataset.xsd" I named that Dataset as "EveryVehicle1"

    After that, i add the fields of the Dataset in a Tablix in the Report File, and i run my project!

    Everything is fine, exept one column of the Table, that is not show data at all! I have the column, I have the Header, but no Data


    Sunday, April 29, 2018 7:36 PM

All replies

  • Hi,

    I'm not sure how did you add the data to the report viewer, please refer to the following steps:

    1, Add a report to your project(then move the report to: ...\bin\Debug\Report1.rdlc):

    2, Add a dataset to the project:

    3, Drag a DataTable to the dataset and add some fields:

    4, Drag a table to the report interface:

    5, Then the code:

    Private Sub Form1_Load(sender As Object, e As EventArgs)
    	Dim dt As New DataTable()
    	Dim rds As New ReportDataSource("DataSet1_DataTable1", dt)
    	Dim startupPath As String = Environment.CurrentDirectory
    	reportViewer1.LocalReport.ReportPath = startupPath & Convert.ToString("\Report1.rdlc")
    	reportViewer1.LocalReport.DataSources.Add(rds)
    	reportViewer1.RefreshReport()
    	'this.reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout); 
    End Sub

    Regards,

    Frankie


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, April 30, 2018 8:12 AM
  • You can also try the Visual Studio Report Controls for issues with RDLC and ReportViewer.

    La vida loca

    Monday, April 30, 2018 9:30 PM