none
Adding report to reportviewer RRS feed

  • Question

  • Hello All,
    Sorry but I have to ask this question :) also I'm very new in Visual Basic (I'm using VB 2008) and what I'm requesting could sound stupid, also I have read lots of posts regardin reportviewer, but nothing clear for me untill this moment.
    I want to run several reports in the reportviewer.
    Some of the reports have  different dataset's and they will be stored on a share folder(on my computer), meaning that I will have to use report path to reach the report.
    What are the exact steps in making this?
    I.e:
    1. Declare the report datasource
    dim rds As Microsoft.Reporting.WinForms.ReportDataSource = New Microsoft.Reporting.WinForms.ReportDataSource

    2.reset the report
    ReportViewer1.Reset()

    3.set the report path
    ReportViewer1.LocalReport.ReportPath= "report path"

    4.clear datasource
    ReportViewer1.LocalReport.DataSources.Clear()

    '

    5.Report data source name
    rds.Name = "report_name"

    and so on.
    Please help me wiht the exact steps, where should I fill the dataset etc.

    Please see a part of my code.
    I'm sure that it's wrong but just to understand what i'm trying to do

    *********************************************************************************

    'These are some variables that I extract from a database, I'm using them to make
    'CMVREPORTLIST.Text is the value of a dropdownlist, that I use to select the reports from
    'CMV_Administration is the name of my application
    Dim rap_name As String
            Dim rap_path As String
            Dim rap_base As String

            Dim cale_rapoarte = From cmv_reports In CMVRPTDS.CMV_REPORTS _
                                Where cmv_reports.REPORT_NAME = CMVREPORTLIST.Text _
                                 Select cmv_reports.REPORT_PATH, cmv_reports.REPORT_NAME, cmv_reports.REPORT_BASE Distinct
            For Each cmv_reports In cale_rapoarte
                rap_name = cmv_reports.REPORT_NAME
                rap_path = cmv_reports.REPORT_PATH
                rap_base = cmv_reports.REPORT_BASE

            Next cmv_reports



     

            Dim cale_raport As String
            cale_raport = rap_path & rap_name

           


            Dim rds As Microsoft.Reporting.WinForms.ReportDataSource = New Microsoft.Reporting.WinForms.ReportDataSource

            Me.ReportViewer1.Reset() 'Reset control to clear previous report information

            Me.ReportViewer1.LocalReport.ReportEmbeddedResource = "CMV_Administration." & rap_name

            Me.ReportViewer1.LocalReport.DataSources.Clear()
            rds.Name = rap_base

            rds.Value = REPORT_DATASET.Tables(0)
            Me.ReportViewer1.LocalReport.DataSources.Add(rds)

            Me.ReportViewer1.RefreshReport()


    *********************************************************************************



    Please do not take in consideration the code above, please help me with the exact steps that I must take to make a report run, when I press the button, with the rest I will mange .

    Please help
    Thank you in advance.
    Ionut


    Friday, March 20, 2009 3:39 PM

All replies