Methoun Ahmed

Methoun Ahmed

  • NA
  • 145
  • 101.9k

How to give the path for crystal report in c#

Jan 16 2018 4:58 AM
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 (3)