Hi,
try
{
string spath = AppDomain.CurrentDomain.BaseDirectory;spath += "myReportFileName.rpt";
ReportDocument cryRpt = new ReportDocument();
cryRpt.Load(spath);
cryRpt.DataSourceConnections[0].SetConnection("Server Name", "DB Name", true);
cryRpt.DataSourceConnections[0].IntegratedSecurity = true;
cryRpt.SetParameterValue("Field Name", "Value");
cryRpt.RecordSelectionFormula = "Correct Formula";
crystalReportViewer1.ReportSource = cryRpt;crystalReportViewer1.Refresh();
}
catch (System.Exception ex)
{
MessageBox.Show("Error: " + ex.Message);
}
In my system, this code is ok. But in other system, It has error. I installed in all other systems crystal report correctly.
This code was executing with error:
crystaldecisions.crystalreports.engine.reportdocument' threw an exception
Then i executed **CRRuntime_32bit_13_0_3.msi** in client system. That error solved **But** other problem:
After to run code, the "Database Login" dialog is showing, and I don't connect to database automatically, and don't view the report file!!!
please help me, what have to i do?
What I have tried:
To view .rpt file in C# code, dynamically set server and database