none
Subreport and Drillthrough reports RRS feed

  • Question

  • Hi there all, i'm really stuccoed this time.

    Two are my main concern. But i believe that the reason why is the same.

    I cannot pass the DataSet1 to the sub report in the drill through event.

    I have spend many many hours and investigated a lot of forum here but i didnt find a solid solution.

    My coding is done in VBNET (Visual studio 2010).

    My scenario:

    a basic report that populate a table list and then the user can click on a row and drill through it in the detail report.

    I was able to:

    1. pass parameter to the subreport

    2. trigger the drillthrough event.

    But each time i click the 

    A datasource instance has

    not been supplied for the source 'DataSet1'

    pops "dramatically" up!

    No way. In my small project i have a dataset called ePosDataSet1 that contains two Tables. the first is "CEDI" table, the second "CEDI_PDV" table.

    Here is my sample code

    Is there anyone who can help before i decide to hang up somewhere?

    THANKSS All folks!

    Public Sub ReportViewer1_Drillthrough(ByVal sender As Object, ByVal e As

    Microsoft.Reporting.WinForms.DrillthroughEventArgs) Handles

    ReportViewer1.Drillthrough

            Dim pInfo As ReportParameterInfoCollection

            pInfo = e.Report.GetParameters

            Dim d As ReportParameterInfo

            Dim i As Integer

            i = 0

            Dim mySku As String

            For Each d In pInfo

                If i = 0 Then mySku = d.Values.Item(0).ToString

                i = i + 1

            Next

            Dim mySQL As String

            Dim localreport = e.Report

            Open_myPos()

            Dim MyCommand As New SqlCommand()

            Dim myDA As New SqlDataAdapter()

            Dim Level1DataSet As New DataSet() 'The DataSet you created.

            Dim Level1SearchValue = New SqlParameter("@sku", mySku)

            mySQL = "SELECT CP, BANDIERA, DATA,  SKU_CP, SKU_DESC,

    OOS,SUM(VENDUTO) AS VENDUTO, SUM(MEDIA_VENDUTO) AS MEDIA_VENDUTO, SUM(GAP)

    AS GAP, "

            mySQL = mySQL & "SUM(GAP * PREZZO) AS GAP_VALUE "

            mySQL = mySQL & "FROM dbo.Q_OOS_Index_Completo "

            mySQL = mySQL & " WHERE SKU_CP = '" & mySku & "' "

            mySQL = mySQL & "GROUP BY CP, BANDIERA, DATA, SKU_CP, SKU_DESC, OOS"

            MyCommand.Connection = con

            MyCommand.CommandText = mySQL

            MyCommand.CommandType = CommandType.Text

            myDA.SelectCommand = MyCommand

            myDA.Fill(Level1DataSet, "ePosDataSet1")

            con.Close()

            Dim level1datasource = New ReportDataSource("ePosDataSet1",

    Level1DataSet.Tables(0))

            ReportViewer1.LocalReport.DataSources.Clear()

            ReportViewer1.LocalReport.DataSources.Add(level1datasource)

            ReportViewer1.LocalReport.Refresh()

        End Sub

    Friday, April 26, 2013 6:40 PM