簡體   English   中英

將數據庫移至另一台服務器時,Crystal Reports無法打開

[英]Crystal Reports are not opening when database moved to another server

請考慮,我的數據庫位於一台服務器“ RiboServer”中,而IIS位於另一台服務器“ IISServer”中。 由於RiboServer中的某些問題,我已將數據庫還原到另一台服務器“ NewServer”。

由於此更改,我的Web應用程序運行正常。 但是所有的水晶報道都沒有打開。

該錯誤顯示為ASP.stores_indent_ascx-無法打開連接。 詳細信息:[數據庫供應商代碼:17]無法打開連接。 IndentPOMRV {7BAD9D95-0A37-4041-8CBD-F4A3527C646E} .rpt詳細信息:[數據庫供應商代碼:17]

這是我的代碼:

CrystalDecisions.CrystalReports.Engine.ReportDocument rpt =
                new CrystalDecisions.CrystalReports.Engine.ReportDocument();
try
{
    string conn = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
    string[] str = conn.Split(';');
    string server = str[0].Substring(str[0].IndexOf(" = ") + 3);
    string database = str[1].Substring(str[1].IndexOf(" = ") + 3);
    string userid = str[2].Substring(str[2].IndexOf(" = ") + 3);
    string password = str[3].Substring(str[3].IndexOf(" = ") + 3);

    rpt.Load(Server.MapPath("~/Purchase/Reports/SupplyPurchaseorder.rpt"));

    for (int i = 0; i < rpt.DataSourceConnections.Count; i++)
        rpt.DataSourceConnections[i].SetConnection(server, database, userid, password);
    rpt.SetParameterValue(0, POID);
    rpt.SetParameterValue(1, UserName);
    rpt.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, HttpContext.Current.Response, true, "SupplyPurchaseOrder");
}
catch (Exception ex)
{
    rpt.Dispose();
    BussinessLayer.RIBOException.Instance.HandleMe(this, ex);            
}

我可以理解上面的錯誤。 但是在我的應用程序中,我有更多的Crystal報表,很難更改每個報表中的數據庫連接。 因此,請提出解決方案。

使用Crystal Reports SDK。 例。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM