Add more datatable to report

Stimulsoft Reports.NET discussion
Post Reply
sjhosseini
Posts: 1
Joined: Wed Jan 20, 2010 11:18 pm

Add more datatable to report

Post by sjhosseini »

i design report in designer with dataset source that have two tables
i want to fill them with my data table in application code at print button click
i write below code to do this
when i have on datatable in dataset i have no problem and one data bound will fill at report but when add second dt to dataset no data show at report
class1 clsRecord = new class1();
class2 clsRecord2 = new class2();
DataSet ds1 = new DataSet();
DataTable dt1= new DataTable();
DataTable dt2 = new DataTable();
dt2 = clsRecord.Get_All_Record();
dt1 = clsRecord2.Get_All_Record();
stiReport1.Load(Application.StartupPath + "\\Reports\\rep1.mrt");
ds1.Tables.Add(dt1);
ds1.Tables.Add(dt2);

stiReport1.RegData(ds1);
stiReport1.Dictionary.Synchronize();
stiReport1.Show();

Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Add more datatable to report

Post by Edward »

Hi

The problem could be in the fact that the Connection name in your report is not a "DataSet1" and Name of DataSources are not Table1 and Table2 accordingly. These names are default when you create DataSet and add tables there.

Please try to modify your code as follows:

DataSet ds1 = new DataSet("ConnectionNameInTheReport");
DataTable dt1= new DataTable("NameOfTheDataSourceInTheReport1");
DataTable dt2 = new DataTable("NameOfTheDataSourceInTheReport1");

If all names matched then difficult to say something without your report.

Thank you.
Post Reply