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
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
.ReportPath = Application.StartupPath & "\..\..\CarReport.rdlc"
.DataSources.Clear()
End With
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")
Dim rptDataSource As New ReportDataSource("dsCar_viewcar", ds.Tables("viewcar"))
Me.ReportViewer1.LocalReport.DataSources.Add(rptDataSource)
End Using
End Using
ReportViewer1.RefreshReport()
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