2017-06-29 1 views
0

これは古いアプリケーションです ウェブページのクリスタルレポートを表示していますが、何かの上に再度パラメータを要求しているが、同じレポートを表示しています私はサブをクリックしているので、これを行う方法はわかりません同じレポートを同じパラメータを尋ねると同じレポートを表示するツールバーをクリックしたときにパラメータを再度尋ねるCrystalレポートビューア(サブレポート何か)と同じメインページを表示して返信する

protected void Page_Load(object sender、EventArgs e) { if(!IsPostBack) {

 var p = Request.QueryString["P"].ToString(); 
     var appId = int.Parse(Request.QueryString["appId"].ToString()); 
     var HE = new HIVAIDSEntities(); 
     var app = HE.ApplicatioNames.FirstOrDefault(x => x.Hivrp_app_name_pk == appId); 



     //SQLReport report = new SQLReport(); 
     var report = new ReportDocument(); 
     // Application.StartupPath 
     report.Load(filename: Server.MapPath(p)); 
     //Get SQL Server Details 
     string zServer = app.Hivrp_server_name; 
     string zDatabase = app.Hivrp_database_name; 
     string zUsername = app.Hivrp_user_id; 
     string zPassword = app.Hivrp_password; 

     var ciReportConnection = new ConnectionInfo 
     { 
      ServerName = zServer, 
      DatabaseName = zDatabase, 
      UserID = zUsername, 
      Password = zPassword 
     }; 

     //TableLogOnInfo crTableLogoninfo = new TableLogOnInfo(); 
     //Assign data source details to tables 

     foreach (CrystalDecisions.CrystalReports.Engine.Table table in report.Database.Tables) 
     { 

      table.LogOnInfo.ConnectionInfo = ciReportConnection; 
      table.ApplyLogOnInfo(table.LogOnInfo); 

     } 


     //Assign data source details to the report viewer 
     if (this.CrystalReportViewer1.LogOnInfo != null) 
     { 
      TableLogOnInfos tlInfo = this.CrystalReportViewer1.LogOnInfo; 
      foreach (TableLogOnInfo tbloginfo in tlInfo) 
      { 
       tbloginfo.ConnectionInfo = ciReportConnection; 
      } 
     } 
     CrystalReportViewer1.ReportSource = report; 
     CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None; 
     CrystalReportViewer1.DisplayPage = true; 

     CrystalReportViewer1.RefreshReport(); 
     Session["ReportDocument"] = report; 
    } 
    else 
    { 
     ReportDocument doc = (ReportDocument)Session["ReportDocument"]; 
     CrystalReportViewer1.ReportSource = doc; 
     CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None; 
     CrystalReportViewer1.DisplayPage = true; 

     CrystalReportViewer1.RefreshReport(); 

    } 

答えて

0

Page_Load関数をPage_Initに変更しましたが、すべて正常に動作しています:)

関連する問題