Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42406

New to ReportViewer ... I Cannot get to work

$
0
0
Hello,
I have been trying to find an answer to this all day and I just cannot get my web page to work.
I am currently getting this error "The source of the report definition has not been specified"


Here is the code.

Code:

Protected Sub rvNavReports_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles rvNavReports.Load
        If Session("ReportReady") = True Then
            GenerateReports()
        End If
    End Sub

    Protected Sub rvNavReports_PageNavigation(ByVal sender As Object, ByVal e As Microsoft.Reporting.WebForms.PageNavigationEventArgs) Handles rvNavReports.PageNavigation
        If Session("ReportReady") = True Then
            GenerateReports()
        End If
    End Sub

    Private Sub GenerateReports()
        Try
            Dim param As ReportParameter() = New ReportParameter(0) {}
            param(0) = New ReportParameter("ReportTitle", strReportTitle)
            rvNavReports.LocalReport.SetParameters(param)
            Dim ds As DataSet = GetDataset()
            Dim rds As New ReportDataSource("Reportds", ds)
            rvNavReports.LocalReport.ReportPath = myPath
            rvNavReports.LocalReport.DataSources.Clear()
            rvNavReports.LocalReport.DataSources.Add(rds)
            rvNavReports.LocalReport.Refresh()
        Catch ex As Exception
            If IsNothing(ex.InnerException) Then
                txtMsg.Text = "Error in GenerateReports - Message:  " & ex.Message
            Else
                txtMsg.Text = "Error in GenerateReports - InnerException:  " & ex.InnerException.ToString
            End If
            txtMsg.Visible = True
            Exit Sub
        End Try
        rptValues.Visible = False
        rptViewer.Visible = True
    End Sub

Function GetDataset()
        Dim strFromDate As String
        Dim strToDate As String
        Dim strLeadType As String
        Dim strWhere As String
        Dim strAgents As String
        Dim strStatus As String
        Dim strLocs As String

        Dim bAll As String
        Dim iCnt As Integer

        strSQL = Nothing
        myPath = Nothing

        strReportTitle = " From " & dtFromDate.Date & " to " & dtToDate.Date

        strSQL = Code that I removed to save space.

        Dim ds As New DataSet
        Using cnn As New SqlConnection(ConfigurationManager.ConnectionStrings("cnfpccarecentre").ToString)
            Dim cmd As New SqlCommand(strSQL, cnn)
            Dim sda As New SqlDataAdapter(cmd)
            sda.Fill(ds.Tables("Reportds"))
            sda.Dispose()
            cmd.Dispose()
        End Using
        Return ds
    End Function

Thanks for your help in advance
Eddi Rae

Viewing all articles
Browse latest Browse all 42406

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>