问题描述
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);
}
在我的系统中,此代码没问题。但在其他系统中,它有错误。我在所有其他系统中正确安装了水晶报告。
此代码执行时出错:
crystaldecisions.crystalreports.engine.reportdocument'threw一个例外
然后我在客户端系统中执行** CRRuntime_32bit_13_0_3.msi **。那个错误解决了**但**其他问题:
运行代码后,显示数据库登录对话框,我没有自动连接到数据库,也没有查看报告档案!!!
请帮帮我,我该怎么办?
什么我试过了:
要在C#代码中查看.rpt文件,请动态设置服务器和数据库
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
推荐答案
这篇关于C#中的动态加载.rpt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!