1

这两件事有区别吗。我正在尝试将一些报告从本地服务器移动到开发服务器,并且我知道我们已经在开发服务器上安装了 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;
        }
    }
4

1 回答 1

0

您尚未从给定路径加载报告。

请看下面的链接

于 2012-10-04T14:38:17.027 回答