Ask a questionAsk a question
 

AnswerData not getting displayed in report viewer

  • Wednesday, November 04, 2009 9:15 AMVB_netBeginner09 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi ,
    Iam trying to display the database table using reportviewer object.
    Iam using Mysql database,
    iam able to populate results in Datagridview object
    Some how the table is not getting visible in report viewer,
    In a form i created a reportviewer object,also added reportitem in the project

    Below is the code used,

    Dim
    
    mycon As
    MySqlConnection = New
    MySqlConnection("Server=IP;Database=abc;User ID=root;Password=123;" )
    Dim sql As MySqlCommand = New MySqlCommand("SELECT * FROM table" , mycon)
    mycon.Open()
    Dim myadp As MySqlDataAdapter = New MySqlDataAdapter(sql)
    Dim myds As DataSet = New DataSet()
    myadp.Fill(myds, "table" )

    'I can see datagridview

    DataGridView1.DataSource = myds.Tables("table" ).DefaultView

    'Dim table1 As DataTable

    'table1 = myds.Tables(0)

    Me .ReportViewer1.ProcessingMode = ProcessingMode.LocalReportViewer1.LocalReport.ReportPath = "C:\Documents and Settings\Admin\My Documents\Visual Studio 2005\Projects\Myapp\Myapp\Report1.rdlc"

    Me .ReportViewer1.LocalReport.DataSources.Clear()
    Me .ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("table" , myds.Tables("table" )))

    Me .ReportViewer1.RefreshReport()

    mycon.Close()
    Could any one please help,
    Thanks in advance ,

Answers

All Replies

  • Wednesday, November 04, 2009 7:08 PMMalange Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    I think the problem is your code is the source of your locl file.

     

    Try it 
    
     Using CMM As New SqlConnection(sStrin)
                Dim Dataap As New SqlDataAdapter(New SqlCommand("Select * From Table_Inf Where FirstName='" & NN & "'", CMM))
                CMM.Open()
                Dim MeTable As New DataSet
                MeTable.Tables.Add("Table_Inf")
                Dataap.Fill(MeTable, "Table_Inf")
                Dim DB As New BindingSource
                DB.DataSource = MeTable.Tables("Table_Inf")
                Me.DataGridView1.DataSource = DB
    
                'Me.ReportViewer1.Reset()
                Me.ReportViewer1.ProcessingMode = ProcessingMode.Local
    
                Dim newds As New  _
                Microsoft.Reporting.WinForms.ReportDataSource("MeTable")
                newds.Value = DB
    
                Me.ReportViewer1.LocalReport.DataSources.Add(newds)
    
                Me.ReportViewer1.LocalReport.ReportEmbeddedResource = "ClientReportApp.Report2.rdlc" ---put the c:/ souce here
                Me.ReportViewer1.RefreshReport()
    
    
            End Using

     

     

     

    End Using


    Don't judge me, just Upgrade me. Thanks! 
    • Edited byMalange Friday, November 06, 2009 6:40 PM
    • Edited byMalange Friday, November 06, 2009 6:37 PM
    •  
  • Thursday, November 05, 2009 4:24 AMVB_netBeginner09 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    Hi,
    Thanks for the mail,
    When i use the below command   i get error,
    Me.ReportViewer1.ProcessingMode = ProcessingMode.LocalReportViewer1.LocalReport.ReportPath = "C:\Documents and Settings\Admin\My Documents\Visual Studio 2005\Projects\Myapp\Myapp\Report1.rdlc"
    So iam coding as mentioned below

    Me.ReportViewer1.ProcessingMode = ProcessingMode.Local
    ReportViewer1.LocalReport.ReportPath = "C:\Documents and Settings\Admin\My Documents\Visual Studio 2005\Projects\Myapp\Myapp\Report1.rdlc"


    Also when i use
    Me.ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource(MeTable))
    
    

    iam getting error
    Value of type 'System.Data.DataRow' cannot be converted to 'String'.

    Do i miss anything ?

    Please help,
    Thanks,
  • Friday, November 06, 2009 11:32 PMMalange Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    have look now, few changes, I did...
    Don't judge me, just Upgrade me. Thanks!
  • Monday, November 09, 2009 12:17 PMVB_netBeginner09 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks for the reply,
    I actually didn understand the solution ,
    Do i have to change the report path to C:?
    Please clarify,
    Thanks,
  • Monday, November 09, 2009 9:12 PMMalange Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks for the reply,
    I actually didn understand the solution ,
    Do i have to change the report path to C:?
    Please clarify,
    Thanks,

    yes, make sure the patch is right? do you when you run the application, what happen with your report? what msg shows in it?

    Don't judge me, just Upgrade me. Thanks!
  • Tuesday, November 10, 2009 4:16 AMVB_netBeginner09 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks for the reply,
    I actually didn understand the solution ,
    Do i have to change the report path to C:?
    Please clarify,
    Thanks,

    yes, make sure the patch is right? do you when you run the application, what happen with your report? what msg shows in it?

    Don't judge me, just Upgrade me. Thanks!


    Thanks for the reply,
    Please find below the error message

    An error Occured during local report processing The report definition for report'C:\Documents and Settings\Report1.rdlc'has not been specified

    Please suggest a solution,
    Thanks ,
  • Tuesday, November 10, 2009 8:10 AMMaDFroG20091013 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
  • Tuesday, November 10, 2009 11:07 AMJeff ShanMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi VB_netBeginner09,

    Do you want to connect a Dataset created in code with ReportViewer? I think you can look into the following link for some information
    http://social.msdn.microsoft.com/Forums/en-US/vsreportcontrols/thread/94874327-e47e-4218-8e62-1962828f2a60

    You can consider posting it at  Visual Studio Report Controls  forum for quicker and better responses. Thanks!

    Regards
    Jeff Shan


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Tuesday, November 10, 2009 10:04 PMMalange Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I think you have not created your rdlc, Properly. have a look here just follow it:
    http://social.msdn.microsoft.com/Forums/en-US/vsreportcontrols/thread/94874327-e47e-4218-8e62-1962828f2a60

     


    Don't judge me, just Upgrade me. Thanks!
  • Wednesday, November 11, 2009 1:16 AMMaDFroG20091013 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    @Malange
    You provided the same link as Jeff did!!!
  • Thursday, November 12, 2009 8:43 PMMalange Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    @Malange
    You provided the same link as Jeff did!!!

    ok. and what is the problem? Thanks to let me know.
    Don't judge me, just Upgrade me. Thanks!