这两件事有区别吗。我正在尝试将一些报告从本地服务器移动到开发服务器,并且我知道我们已经在开发服务器上安装了 redist,但在运行报告时仍然遇到问题。运行时是否分开?
*编辑 - 发布代码以查看 dotjoe 是否建议我错误地标记了我的报告路径。数据库连接从一个方法返回到一个字符串数组reportString,这就是那个数组。
<CR:CrystalReportViewer ID="CrystalReportViewer2" runat="server"
AutoDataBind="True" Height="50px" Width="350px" ReuseParameterValuesOnRefresh="True" ToolbarImagesFolderUrl="~/images/reportViwerImages"/>
ConnectionInfo myConnectionInfo = new ConnectionInfo();
myConnectionInfo.ServerName = reportString[1];
myConnectionInfo.DatabaseName = reportString[0];
myConnectionInfo.UserID = reportString[2];
myConnectionInfo.Password = reportString[3];
string ReportPath = Server.MapPath("../../mdReports/CrystalReport.rpt");
CrystalReportViewer2.ReportSource = ReportPath;
ParameterField field1 = new ParameterField();
ParameterDiscreteValue val1 = new ParameterDiscreteValue();
val1.Value = hiddenFieldReportNumber.ToString();
field1.CurrentValues.Add(val1);
SetDBLogonForReport(myConnectionInfo);
private void SetDBLogonForReport(ConnectionInfo myConnectionInfo)
{
TableLogOnInfos myTableLogOnInfos = CrystalReportViewer2.LogOnInfo;
foreach (TableLogOnInfo myTableLogOnInfo in myTableLogOnInfos)
{
myTableLogOnInfo.ConnectionInfo = myConnectionInfo;
}
}