1
Answer

How to give the path for crystal report in c#

Photo of Methoun Ahmed

Methoun Ahmed

7y
164
1
Hi,
I had created an application in c#.
But when i **move this appication to another drive,folder or PC.
I got error at crystal report **path. and need to change the path at every time when appication moved.
How to fix this problem.
means how to add it into c# resources so that path will be fix.
i will tried 
 
SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=ITRDB;Integrated Security=True");
ReportDocument crypt = new ReportDocument();
public ReportViewer()
{
InitializeComponent();
}

private void crystalReportViewer1_Load(object sender, EventArgs e)
{
SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM tblITReport WHERE Date between'"+fdate+"'and'"+tdate+"'",con);
DataTable dt = new DataTable();
DataSet dst = new DataSet();
sda.Fill(dst, "tblITReport");
crypt.Load(@"D:\My Project\C# Applicatin\ITReport\ITReport\ITReport\ITReport.rpt");
crypt.SetDataSource(dst);
crystalReportViewer1.ReportSource = crypt;

Answers (1)

0
Photo of Sagar  Pandurang Kap
NA 2.7k 7.6k 7y
Hi,
Try below link it will give you best answer:-
 
https://www.codeproject.com/Questions/316286/How-to-give-the-path-for-crystal-report-in-csharp
 
Hope it helps......