I am trying to connect 2 datasets which both have multiple tables and also have a relation. To give you an idea of the data involved here is the datascheme i'm using:
Dataset customers:
table customers
table orders
Dataset detail:
table orderdetails
The tables customers and orders have a one to many relation.
This is the code I use to attach the data source to stimulsoft
Code: Select all
StiReport report = new StiReport();
DataSet set = new DataSet();
set.ReadXmlSchema("customer.xsd");
set.ReadXml("customer.xml");
DataSet set2 = new DataSet();
set2.ReadXmlSchema("detail.xsd");
set2.ReadXml("detail.xml");
report.RegData("dataset1", set);
report.RegData("dataset2", set2);
Then I tried to create a relation between the product table and the ordersdetails table and I get the following error:
After which I added the following line of code after instantiating the StiReports object:Parent Data Source 'Orders' and Child Data Source 'detail' is not located in one DataSet and can't be used in relation 'Name'! You can use property CacheAllData of report to cache this Data Source to one DataSet.
Code: Select all
report.CacheAllData = true;
Am I doing something not supported by Stimulsoft or is it a small bug?Cannot remove unique constraint 'Constraint1'. Remove foreign key constraint 'Customer_Orders' first.
Edit: oh yeah, heres the stack trace of the exception:
Code: Select all
at System.Data.UniqueConstraint.CanBeRemovedFromCollection(ConstraintCollection constraints, Boolean fThrowException)
at System.Data.ConstraintCollection.Remove(Constraint constraint)
at System.Data.DataTable.set_PrimaryKey(DataColumn[] value)
at System.Data.ConstraintCollection.Clear()
at Stimulsoft.Report.Dictionary.StiDictionary.Disconnect()
at Stimulsoft.Report.Engine.StiRenderProviderV2.Render(StiReport report, StiRenderState state)
at Stimulsoft.Report.Engine.StiReportV2Builder.RenderSingleReport(StiReport masterReport, StiRenderState renderState)
at Stimulsoft.Report.StiReport.RenderReport(StiRenderState renderState)
at Stimulsoft.Report.StiReport.Render(StiRenderState renderState, StiGuiMode guiMode)
at Stimulsoft.Report.StiReport.RenderWithWpf(Boolean showProgress)
at Stimulsoft.Report.WpfDesign.StiWpfDesignerPreviewControl.buttonRefresh_Click(Object sender, RoutedEventArgs e)