C#:通过Crystal Report从Oracle数据库获取报告

时间:2017-10-03 01:47:42

标签: c# .net oracle crystal-reports

我遇到了麻烦。

我在我的项目中使用水晶报告。并且在报告文件中工作正常。但在我的WinForm应用程序中始终保持提示登录信息,并输入正确的登录信息。但它给了我错误:"登录失败。请再试一次"

我尝试过:

  • 适用于Oracle的OLE DB提供程序
  • Oracle Server

我的按钮点击活动

            int FlightIDParameter = Convert.ToInt32(ReportSelectedFlightNumber.SelectedValue);
            ReportDocument cryRpt = new ReportDocument();
            cryRpt.Load(@"MYPATH\TestReport.rpt");
            cryRpt.SetParameterValue("FLIGHT_ID", FlightIDParameter);
            ReportViewer.ReportSource = cryRpt;
            ReportViewer.Refresh(); 

我也试过这段代码

    ReportDocument cryRpt = new ReportDocument();
    TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
    TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
    ConnectionInfo crConnectionInfo = new ConnectionInfo();
    Tables CrTables ;
    cryRpt.Load("my path\TestReport.rpt");

    crConnectionInfo.ServerName = "my SERVER NAME";
    crConnectionInfo.DatabaseName = "my DB NAME";
    crConnectionInfo.UserID = "my  USERNAME";
    crConnectionInfo.Password = "my PASSWORD";

    CrTables = cryRpt.Database.Tables ;
    foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
    {
        crtableLogoninfo = CrTable.LogOnInfo;
        crtableLogoninfo.ConnectionInfo = crConnectionInfo;
        CrTable.ApplyLogOnInfo(crtableLogoninfo);
    }

    ReportViewer.ReportSource = cryRpt;
    ReportViewer.Refresh(); 

everytime when i get report, keep asking me logon details

I've inserted correct password, still gives me error

  1. 为什么我的正确登录信息会被拒绝?
  2. 我不希望每次都有这个登录窗口。

0 个答案:

没有答案