954,164 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to connect data base to reportviewer control

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

sudharani
Newbie Poster
21 posts since Sep 2009
Reputation Points: 7
Solved Threads: 1
 

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!!!

reach_yousuf
Junior Poster
195 posts since Sep 2007
Reputation Points: 12
Solved Threads: 38
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You