When i installing my windows app it shows error
'report load failed'
i think its not getting a valid report path.
Anyone can tell me the application path for report
by which it run on other systems.
Many thanks in advance.
What I have tried:
string DRIOutConn=Application.StartupPath;
private OleDbConnection con = new OleDbConnection();
public void connection()
{
con = new OleDbConnection(@"Provider=MICROSOFT.ACE.OLEDB.12.0;Data Source=" + DRIOutConn + "\\ECOFRESH.mdb;Jet OLEDB:Database Password=mbd");
}
private OleDbCommand cmd = new OleDbCommand();
private OleDbDataAdapter ad = new OleDbDataAdapter();
private DataSet ds = new DataSet();
private void FrmReport_Load(object sender, EventArgs e)
{
connection();
MessageBox.Show(con.DataSource);
cmd = new OleDbCommand("select * from tempData",con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
ad = new OleDbDataAdapter(cmd);
ds = new DataSet();
ad.Fill(ds, "dt_tempdata");
if (ds.Tables[0].Rows.Count > 0)
{
ReportDocument cryRpt = new ReportDocument();
//cryRpt.Load(@"C:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\DRI_NEW_SERIES_10march2018\DRI_NEW_SERIES\test.rpt");
//cryRpt.Load(DRIOutConn + @"Reports\Report\test.rpt");
//cryRpt.Load(Application.StartupPath.Substring(0, Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf("\\")).LastIndexOf("\\")) + "\\test.rpt");
cryRpt.Load(Application.UserAppDataPath + "\\test.rpt");
cryRpt.SetDataSource(ds.Tables["dt_tempdata"]);
crystalReportViewer1.ReportSource = cryRpt;
//cryRpt.Load(@"C:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\DRI_NEW_SERIES\DRI_NEW_SERIES\CrystalReport1.rpt");
//cryRpt.FileName = "test.rpt";
//cryRpt.SetDatabaseLogon("admin", "mbd");
//crystalReportViewer1.ReportSource = cryRpt;
crystalReportViewer1.Refresh();
}