A data source instance has not been supplied for the datasource RRS feed

  • Question

  • Hi All,

    I am creating drill through report. parent report run successfully and display desire result but when i am trying to access drill through report it will give me error i.e. "A data source instance has not been supplied for the datasource "TEPLDataset2_LForm".

    My code:-

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
                Me.ReportViewer1.Visible = True
                Me.InwardTableAdapter.Fill(Me.TEPLDataSet2.Inward, DateTimePicker1.Text, DateTimePicker2.Text)
            Catch ex As Exception
            End Try
        End Sub

        Private Sub ReportViewer1_Drillthrough(ByVal sender As Object, ByVal e As Microsoft.Reporting.WinForms.DrillthroughEventArgs) Handles ReportViewer1.Drillthrough

                Dim ds As ReportDataSource = Nothing
                Dim lr As LocalReport = CType(e.Report, LocalReport)
                If InStr(lr.ReportEmbeddedResource, "Report5") > 0 Then
                    ds = ProcessStockReport(lr)
                End If
           Catch ex As Exception
            End Try

        End Sub

        Private Function ProcessStockReport(ByVal lr As LocalReport) As ReportDataSource
            Dim prmReportParms As ReportParameterInfoCollection
            Dim ds As ReportDataSource
            Dim ta As TEPL.TEPLDataSet2TableAdapters.LFormTableAdapter
            Dim dt As TEPL.TEPLDataSet2.LFormDataTable
            If IsNothing(ta) Then
                ta = New TEPL.TEPLDataSet2TableAdapters.LFormTableAdapter
                dt = New TEPL.TEPLDataSet2.LFormDataTable
            End If
            'Capture the value of the parameter passed to the click-through report (ProductStock)
            ' The parameter is defined in the host report as a report parameter
            Dim parmValue As String
            prmReportParms = lr.GetParameters
            If prmReportParms("fabric").State = ParameterState.MissingValidValue Then
                parmValue = 0
                'Pick off the first value
                parmValue = CStr(prmReportParms("fabric").Values(0))
            End If
            'Populate the DataTable using the Custom Fill.
            dt.Clear() 'Flush the previous state
            ta.Fill(dt, parmValue)
            'ds = New ReportDataSource("TEPLDataset2_LForm", dt)
            ds = New ReportDataSource("LFormBindingSource", dt)
            Return ds
        End Function

    Your help will appreciated...............

    Thank you in advance
    Saturday, August 2, 2008 6:57 AM

All replies

  • The general structure of your code looks correct (handling the drillthrough event, populating the eventargs report object).  You may want to double check that the names of the data sets on the drillthrough report are the names you are expecting.  The LocalReport.GetDataSourceNames() method will give you a list of the data sources that must be bound.
    Saturday, August 2, 2008 3:39 PM