2013-07-18 3 views
0

Stimulsoft Reports를 처음 사용하며 여기에서 고민 중입니다. 보고서에 데이터 세트를 표시 할 수 없습니다. 나는 간단한 Report.mrt 파일을 생성하지만winform에서 stimulsoft 보고서 표시

private void button1_Click(object sender, EventArgs e) 
    { 
     DataTable table = GetTable(); 
     DataSet ds = new DataSet("office"); 
     ds.Tables.Add(table); 
     ds.Namespace = "y"; 
     ds.Prefix = "x"; 
     stiReport1.RegData("MyDataSet", ds); 
     stiReport1.Load("D:\\Report.mrt"); 
     stiReport1.Show(); 
    } 

    public DataTable GetTable() 
    { 
     DataTable table = new DataTable(); 
     table.Columns.Add("Dosage", typeof(int)); 
     table.Columns.Add("Drug", typeof(string)); 
     table.Columns.Add("Patient", typeof(string)); 
     table.Columns.Add("Date", typeof(DateTime)); 

     table.Rows.Add(25, "Indocin", "David", DateTime.Now); 
     table.Rows.Add(50, "Enebrel", "Sam", DateTime.Now); 
     table.Rows.Add(10, "Hydralazine", "Christoff", DateTime.Now); 
     table.Rows.Add(21, "Combivent", "Janet", DateTime.Now); 
     table.Rows.Add(100, "Dilantin", "Melanie", DateTime.Now); 
     return table; 
    } 

이 나던 디스플레이 아무것도 ... 내가 지금까지 무엇을했는지 empty.this하고 내가 여기에서 무엇을 할 모르겠습니다. Report.mrt에 텍스트 필드를 추가해야합니까?

답변

1

우선 stiReport1.RegData 앞에 stiReport1.Load을 입력합니다.
그런 다음 보고서를 컴파일해야합니다.

stiReport1.Load("D:\\Report.mrt"); 
stiReport1.RegData("MyDataSet", ds); 
stiReport1.Dictionary.Synchronize(); 
stiReport1.Compile(); 
stiReport1.Show(true);