none
VS 2010 breaks my VS 2008 ReportViewer subreport code RRS feed

  • Question

  • Hi,

    The following ReportViewer subreport VB code worked fine in VS 2008, but now I'm getting this error message in VS 2010 "Overload resolution failed because no accessible 'New' is most specific for these arguments".

    The code that is underlined is what VS 2010 is complaining about.  What do I need to change to get it working again?  BTW, I removed "Microsoft.ReportViewer.Common 9.0.0.0, Microsoft.ReportViewer.WinForms 9.0.0.0" references and replaced them with the 10.0.0.0 versions when I moved my project to VS 2010.

    Thanks.

    Public Sub Subreport1ProcessingEventHandler(ByVal sender As Object, ByVal e As SubreportProcessingEventArgs)

        Dim ta As clientVisDataSetTableAdapters.ProductionScheduleSubTableAdapter = New clientVisDataSetTableAdapters.ProductionScheduleSubTableAdapter
        Dim dt As clientVisDataSet.ProductionScheduleSubDataTable = New clientVisDataSet.ProductionScheduleSubDataTable

         dt.Constraints.Clear()

         ta.Fill(dt, Convert.ToInt32(e.Parameters("WO_ID").Values(0)))
         e.DataSources.Add(New ReportDataSource("clientVisDataSet_ProductionScheduleSub", dt))

    End Sub

    Friday, March 23, 2012 4:44 PM

All replies

  • After playing with the code and checking out other examples, I was able to get it working again using the following:

        Public Sub Subreport1ProcessingEventHandler(ByVal sender As Object, ByVal e As SubreportProcessingEventArgs)

            'needed for subreport processing
            Dim ta As clientVisDataSetTableAdapters.ProductionScheduleSubTableAdapter = New clientVisDataSetTableAdapters.ProductionScheduleSubTableAdapter
            Dim dt As clientVisDataSet.ProductionScheduleSubDataTable = New clientVisDataSet.ProductionScheduleSubDataTable

            dt.Constraints.Clear()

            ta.Fill(dt, Convert.ToInt32(e.Parameters("WO_ID").Values(0)))
            'e.DataSources.Add(New ReportDataSource("clientVisDataSet_ProductionScheduleSub", dt))

            Dim WO_ID As Integer
            WO_ID = Convert.ToInt32(e.Parameters("WO_ID").Values(0))

            e.DataSources.Add(New ReportDataSource("clientVisDataSet_ProductionScheduleSub", LoadWODetailsData(WO_ID)))

        End Sub


        Private Function LoadWODetailsData(WO_ID As Integer) As DataTable

            Dim dataSet As DataSet = New DataSet
            Dim strSQL As String
            Dim MyConnection As OleDb.OleDbConnection = New OleDb.OleDbConnection(CreationsString)

            MyConnection.Open()

            strSQL = "SELECT Job# AS WO, Qty, SQTY, [Inventory Tag#], [Inventory Name], RMAT, RENG, ItemOrigin " & _
                     "FROM View_ProdSched_QuoteItems " & _
                     "WHERE (Job# = " & WO_ID.ToString & ") ORDER BY WO, [Inventory Tag#]"

            Dim da As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(strSQL, MyConnection)

            da.Fill(dataSet)
            MyConnection.Close()
            LoadWODetailsData = dataSet.Tables(0)

        End Function

    Friday, March 23, 2012 10:25 PM