1

Web アプリケーションで Crystal Reports を使用しています。私の問題は、EnableDatabaseLogonPrompt="true" と EnableParameterPrompt="true" を保持し、プロンプト ボックスに情報を提供すると、レポートが正常に機能することです。しかし、それらをfalseのままにしてコードビハインドから情報を提供すると、常に「Missing Param Values」または「Database Logon Failed」というエラーが発生します。

私のコードは以下の通りです:

Aspx ファイル:

       <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" 
            AutoDataBind="True" 
            GroupTreeImagesFolderUrl="" Height="1202px" 
            ReportSourceID="CrystalReportSource1" ReuseParameterValuesOnRefresh="True" 
            ToolbarImagesFolderUrl="" ToolPanelWidth="200px" Width="903px" 
            ToolPanelView="None" EnableDatabaseLogonPrompt="False" 
            EnableParameterPrompt="False" />
        <CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
            <Report FileName="CrystalReport1.rpt">
            </Report>
        </CR:CrystalReportSource>

コードビハインド:

       ReportDocument reportDocument = new ReportDocument();           
       reportDocument.Load(Server.MapPath("~/CrystalReport1.rpt"));
       string s=@"4EVER3-PC\MSSQLSERVER2";
       reportDocument.SetDatabaseLogon("db", "pwd", s, "databasename", true);
       reportDocument.SetParameterValue("@bankACId", "0");
       reportDocument.SetParameterValue("@fromDate", "4/11/2011 17:01:57");
       reportDocument.SetParameterValue("@todate", "4/11/2014 17:01:57");

       CrystalReportViewer1.ReportSource = reportDocument;
       CrystalReportViewer1.RefreshReport();

このコードの何が問題なのか指摘してください。それは私を夢中にさせています。

4

2 に答える 2

1

resolved the logon failed error.

I was accessing the database from another pc and its firewall was not allowing me to connect through crystal report. so i added sql server management studio to the list of allowed programs by firewall. So now connection problem is resolved.

So crystal report without any parameter works fine. but when i pass parameters it force closes the debug server..Any idea what should be the problem.

This is the half answer of my question which may be helpful to those who are facing connection problems.

于 2013-04-12T05:30:08.913 に答える
0

Aspx ファイル:

  <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" 
            AutoDataBind="True" 
            Height="1202px" 
            ReportSourceID="CrystalReportSource1" />
        <CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
            <Report FileName="CrystalReport1.rpt">
            </Report>
        </CR:CrystalReportSource>

コードビハインド:

 protected void btnShowReport_Click(object sender, EventArgs e)
    {
       LoadReport();           
    }

    private void LoadReport()
    {
        doc = new ReportDocument();
        doc.Load(Server.MapPath("CrSalesReport.rpt"));

        doc.SetDatabaseLogon(AppConfig.ReportServerDSUserName, AppConfig.ReportServerDSPassword, AppConfig.ReportServerDomain, "TexERP", false);

   doc .SetParameterValue("@bankACId", "0");
   doc .SetParameterValue("@fromDate", "4/11/2011 17:01:57");
   doc .SetParameterValue("@todate", "4/11/2014 17:01:57");

        CrystalReportViewer1.ReportSource = doc;
    }
于 2013-04-11T11:54:46.253 に答える