2016-11-21 23 views
0

データセットで2つのクエリを作成した後、そのクエリをレポートに設定する 最初のクエリがメインレポートの場合は 、2番目のクエリがサブレポートの場合メインレポートの属性フィールドの1つで表示されています。データセットでサブレポートを埋め込む方法

(ここで:属性フィールドからメインレポートから)私はデータが表示されます同様

誰も私を助けてください...

this is the screenshot form the code

^^しかし、このコードはまだ

間違っています
+0

あなたのコードを貼り付けますスクリーンショット –

答えて

0
ReportDocument RptDocument = new ReportDocument(); 
    protected void Page_Load(object sender, EventArgs e) 
    { 
      DataSet ds = "Your Dataset";   
      CrystalReportViewer1.DisplayGroupTree = false; 
      ds.Tables[0].TableName = "Main Report";  
      RptDocument.Load(Server.MapPath("your rpt file path")); 
      RptDocument.SetDataSource(ds.Table[0]); 
      RptDocument.Subreports[0].SetDataSource(ds.Tables[1]); 
      CrystalReportViewer1.ReportSource = RptDocument; 
      CrystalReportViewer1.DataBind(); 
      CrystalReportViewer1.Visible = true;   
    } 

このコードを参照してください

+0

の広告データセットからクエリを使用するとどうなりますか? *)私はVisual Studio 2012を使用しています –

+0

2つの異なるデータセットを取得し、それをメインレポートとサブレポートに割り当てる必要があります。 –