Hi friends,
in my website i want to display reports using reportViewer control.
I am not able to connect this report viewer to database.
Please help me in solving this.
Thank U

Hi,

Use the following code...

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
         Dim dsTemp As New ProductGridDS
        obj = New InventoryBusiness.ProductBusiness
        dsTemp = obj.GetProductInfo() 'retrieve your data here in dataset

        Dim rds As ReportDataSource
        rds = New ReportDataSource("ProductGridDS_ProductGridInfo", dsTemp.Tables(0)) 'report name =ProductGridDS_ProductGridInfo 

        ReportViewer1.LocalReport.DataSources.Clear()
        ReportViewer1.LocalReport.DataSources.Add(rds)
        ReportViewer1.LocalReport.Refresh()
    End Sub

Pls. mark as solved if it helps you!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.