Reputation: 299
I have deployed a VB.net application which have a Crystal Report in it. The application is running well when i open it from executable file in debug/release directory but when i copy all the files from debug/release directory to another like my documents it returns an error when it executes Crystal Reports. The database connection is fine, the problem is from Crystal Reports.
Here is my code :
Dim report As New ReportDocument
report.FileName = System.IO.Path.GetFullPath("../../ReportNPE.rpt")
report.SetDatabaseLogon(My.Settings.UserSQL, My.Settings.PasswordSQL) 'connect to database
report.SetParameterValue("p_CAR", CAR)
report.SetParameterValue("p_NPEDate", tgl)
report.SetParameterValue("p_Con", Con)
I have tried setting "Copy Local" for the Crystal dll files in the references section to True
How Can I run program on another directory ?
Upvotes: 0
Views: 339
Reputation: 2023
In this line:
report.FileName = System.IO.Path.GetFullPath("../../ReportNPE.rpt")
You're referencing a file that is in a relative location (2 levels above your output directory). When you copy the contents of your output directory to your "My Documents" folder, this file no longer exists in the same relative location (2 levels above "My Documents")
Upvotes: 1