Click here to Skip to main content
14,691,047 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Please I want a help this problem. After I install my project on a client pc, the Microsoftreportviewer show an error. It works fine when testing from visual studio but after installing it on a client pc using the setup project it always show error.

Bello is my code

Imports MySql.Data.MySqlClient
Imports Microsoft.Reporting.WinForms

Public Class CarReportForm

    ' Connection string definition
    Private connString As String = _
         "Server=myserver;Port=3306;Database=hotelmanagementsystemn;Uid=root;Pwd=ben10@@;"

    Private Sub CarReportForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try

            With Me.ReportViewer1.LocalReport

                ' Report path
                .ReportPath = Application.StartupPath & "\..\..\CarReport.rdlc"
                .DataSources.Clear()

            End With


            ' ----------------------------------------------------
            ' Datasource for the main report
            ' ----------------------------------------------------
            Dim SQL As String = "SELECT   Car_ID, Car_No, Car_Type, Full_Name, Room_No, Floor_No, Rent_Charge, Num_of_Cars, Total_Price, Date_Value FROM CarRent_T"

            Using da As New MySqlDataAdapter(SQL, connString)

                Using ds As New DataSet
                    da.Fill(ds, "viewcar")

                    ' You must use the same name as defined in the report Data Source Definition
                    Dim rptDataSource As New ReportDataSource("dsCar_viewcar", ds.Tables("viewcar"))
                    Me.ReportViewer1.LocalReport.DataSources.Add(rptDataSource)

                End Using

            End Using

            ' Refresh the report
            ReportViewer1.RefreshReport()

            ' Add the handler for the subreport
            AddHandler ReportViewer1.LocalReport.SubreportProcessing, AddressOf SubreportProcessingEvent

        Catch ex As Exception
            MessageBox.Show(ex.Message, My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try

    End Sub

    Sub SubreportProcessingEvent(ByVal sender As Object, ByVal e As SubreportProcessingEventArgs)

        Try

            Dim SQL As String = "SELECT  Hotel_Name, Hotel_Address, Hotel_Phone, Email_Address FROM HotelProfile"
            Using da As New MySqlDataAdapter(SQL, connString)
                Using ds As New DataSet
                    da.Fill(ds, "viewhotelpro")
                    Dim rptDataSource As New ReportDataSource("dsCar_viewhotelpro", ds.Tables("viewhotelpro"))
                    e.DataSources.Add(rptDataSource)
                End Using
            End Using

        Catch ex As Exception
            MessageBox.Show(ex.Message, My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try

    End Sub

End Class
Posted
Updated 18-Jun-20 13:47pm
v2
Comments
   
Please always format your code sample with "pre" tags the way I just did for you (click Improve question to see). Format code to make it more readable.
—SA
   
Now, what error? Why do you call it "local processing"? What do you mean? All your code sample is server-side.
—SA

1 solution

Please see my comment to the question. So far, it is incomplete. You did not explain steps to reproduce, what exception do you get, etc. The problem may or may not be in the code you show. You need to use the debugger or logging and study the logs.

If your application really worked locally and did not after deployment, I can see only two questionable piece which could make difference: connection string and the path "\..\..\CarReport.rdlc". Please check up if they are valid in a different hosting environment. Are you sure the same or identical database is accessible from the hosted site? Are you sure that RDLC file is there? A Web application can only access paths under the root directory configured for your site.

But again, the problem could be in some other part of code. You just did not do proper steps to investigate the problem.

—SA
   
Comments
Mathiudi 4-Nov-13 10:52am
   
When I copy the project to another pc that have visual studio install in works fine but after deploying it to a client pc it shown microsoftreportviewer error : The report definition for local report not specify
   
You never need Visual Studio installed to run anything, not even to build any project. But you need to install what's required by RDCL...
—SA
Mathiudi 4-Nov-13 11:13am
   
This is what it always show The report definition for 'C:\Program Files\ICM\Hotel Management System\..\..\CarReport.rdlc\ has not been specified. Could not find file. Any idea please.
   
Okay, did you pay attention for my note of paths? Is it under the site's root? Does the Wen application have required permissions?
—SA
Mathiudi 5-Nov-13 5:38am
   
Thank you very much I've got it and it's working fine
Member 14793231 4-Oct-20 15:19pm
   
would tel me what did u do exactly, i've the same prblm
Mathiudi 5-Nov-13 5:37am
   
Thank you very much I've got it and it's working fine
   
Great. You are very welcome.
Good luck, call again.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900