Problem with creating data relations by using code

Сonversation on different topics
Post Reply
arunika
Posts: 3
Joined: Fri Jan 11, 2008 1:50 am

Problem with creating data relations by using code

Post by arunika »

Hi,
I'm using C# and i have a problem with creating data relations by using code.
How do I convert DataTable into Stimulsoft.Report.Dictionary.DataSource or Please suggest me a way to do creating data relations by using code.

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

Problem with creating data relations by using code

Post by Edward »

Please use the following code for creating of the relation in Dictionary with C#:

Code: Select all

StiDataRelation dataRelation = new StiDataRelation("MyRelation", report.Dictionary.DataSources["Categories"], report.Dictionary.DataSources["Products"], new System.String[]{"CategoryID"}, new System.String[] {"CategoryID"});
report.Dictionary.RegRelations();
report.Dictionary.Relations.Add(dataRelation);
for converting DataTable for the DataSource please use the following code:

Code: Select all

report.RegData("MyDataSource",myDataTable);
P.S. the data also could be changed "behind" the DataSource: You can access to the DataTable with actual data with MyDataSource.DataTable property.

Thank you.
Post Reply