none
Report Viewer bind at runtime not showing data RRS feed

  • Question

  • Hope someone can help me.  I want to produce a report at runtime but even though the dataset has 19 rows in the count the report isn't showing anything.  I'm using Visual Studio 2015.

    Wednesday, February 19, 2020 7:45 PM

Answers

    • Marked as answer by philmarsd Thursday, February 20, 2020 2:15 PM
    Thursday, February 20, 2020 2:15 PM
  •     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Load_Report()
        End Sub
    
        Function Load_Report()
            Dim sqlString As String
            sqlString = "SELECT * FROM Scaffold_Register"
            Dim DsHistory As History = GetData(sqlString)
            Dim rds As New ReportDataSource
            Dim reportDataSource As New ReportDataSource
            rds.Value = DsHistory.Tables("Scaffolds")
            rds.Name = "Scaffolds"
            ReportViewer1.LocalReport.DataSources.Clear()
            ReportViewer1.LocalReport.DataSources.Add(rds)
            ReportViewer1.LocalReport.ReportEmbeddedResource = "AdeptSoftInstpections.Report1.rdlc"
            Me.ReportViewer1.RefreshReport()
        End Function
        Private Function GetData(query As String) As History
            Dim cmd As New SqlCommand(query)
            Using con As New SqlConnection(taggerDBserver)
                Using sda As New SqlDataAdapter()
                    cmd.Connection = con
                    sda.SelectCommand = cmd
                    Using dsCustomers As New History
                        sda.Fill(dsCustomers, "Scaffolds")
                        Return dsCustomers
                    End Using
                End Using
            End Using
        End Function

    • Marked as answer by philmarsd Thursday, February 20, 2020 2:16 PM
    Thursday, February 20, 2020 2:16 PM

All replies

  • Wednesday, February 19, 2020 7:52 PM
  • Wednesday, February 19, 2020 7:52 PM
  • Wednesday, February 19, 2020 7:52 PM
  • Wednesday, February 19, 2020 7:56 PM
    • Marked as answer by philmarsd Thursday, February 20, 2020 2:15 PM
    Thursday, February 20, 2020 2:15 PM
  •     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Load_Report()
        End Sub
    
        Function Load_Report()
            Dim sqlString As String
            sqlString = "SELECT * FROM Scaffold_Register"
            Dim DsHistory As History = GetData(sqlString)
            Dim rds As New ReportDataSource
            Dim reportDataSource As New ReportDataSource
            rds.Value = DsHistory.Tables("Scaffolds")
            rds.Name = "Scaffolds"
            ReportViewer1.LocalReport.DataSources.Clear()
            ReportViewer1.LocalReport.DataSources.Add(rds)
            ReportViewer1.LocalReport.ReportEmbeddedResource = "AdeptSoftInstpections.Report1.rdlc"
            Me.ReportViewer1.RefreshReport()
        End Function
        Private Function GetData(query As String) As History
            Dim cmd As New SqlCommand(query)
            Using con As New SqlConnection(taggerDBserver)
                Using sda As New SqlDataAdapter()
                    cmd.Connection = con
                    sda.SelectCommand = cmd
                    Using dsCustomers As New History
                        sda.Fill(dsCustomers, "Scaffolds")
                        Return dsCustomers
                    End Using
                End Using
            End Using
        End Function

    • Marked as answer by philmarsd Thursday, February 20, 2020 2:16 PM
    Thursday, February 20, 2020 2:16 PM