Reputation: 5866
I am new to Stimulsoft Reports and I am struggling here. I cannot display the data set in the report. I created a simple Report.mrt file but it is empty.this what I have done so far...
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;
}
this doesnt display anything and I am not sure what to do from here. Should I add some text fields to the Report.mrt?
Upvotes: 0
Views: 7186
Reputation: 216293
First of all, I would move the stiReport1.Load
before the stiReport1.RegData
.
Then you should compile the report
stiReport1.Load("D:\\Report.mrt");
stiReport1.RegData("MyDataSet", ds);
stiReport1.Dictionary.Synchronize();
stiReport1.Compile();
stiReport1.Show(true);
Upvotes: 3