Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
I wrote the following code to open a report using visual basic, however what I would like to do is select a range of dates in which I want to use as the sample for the report. I tried a select statement and tried feeding that into the report but got a dataset error.

If anyone would help me out that would be great!

VB
Dim reportDataSource As New ReportDataSource
Try
    With Me.ReportViewer1.LocalReport
        .ReportPath = "C:\CallReport.rdlc"
        .DataSources.Clear()
    End With
    Dim ds As New OCTCADataSet
    Dim da As New OCTCADataSetTableAdapters.CallDataTableAdapter
    da.Fill(ds.CallData)

    reportDataSource = New ReportDataSource("DataSet1", ds.Tables("CallData"))
    Me.ReportViewer1.LocalReport.DataSources.Add(reportDataSource)
    Me.ReportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.Normal)
Catch ex As Exception
    MsgBox("Could not compile and open that report.")
End Try
Posted

1 solution

Hi
I suggest to you look at this link for getting a really good information about report making:

Microsoft Reporting Services (Sub Reports, Charts, Parameters, Expression Editor, etc.)[^]
Applied MS Reporting Services 101 using Smart Client[^]

Best Regards.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900