foreach (DataRelation rs in dbComm.ds.Relations) { Debug.WriteLine(rs.RelationName); Debug.WriteLine(rs.ParentKeyConstraint.ConstraintName); Debug.WriteLine(rs.ChildKeyConstraint.ConstraintName); foreach (DataColumn col in rs.ChildColumns) { Debug.WriteLine(col.ColumnName); } foreach (DataColumn col in rs.ParentColumns) { Debug.WriteLine(col.ColumnName); } } for (int i = 0; i < this.ultraGanttView1.Project.Tasks.Count; i++) { if(this.ultraGanttView1.Project.Key == this.ultraGanttView1.Project.Tasks[i].ProjectKey) { Debug.WriteLine("SAME"); } else { Debug.WriteLine("NOT THE SAME"); } } UltraPrintPreviewDialog printPreview = new UltraPrintPreviewDialog(); printPreview.Document = this.ultraGanttViewPrintDocument1; this.ultraGanttViewPrintDocument1.GanttView = this.ultraGanttView1; printPreview.ShowDialog(this);//The error comes on this line
Error that I get:
Output that I get in the debugger:
Relation1 Constraint1 Relation1 ProjectKey ProjectKey SAME SAME 'ProjectPlanning.exe' (CLR v4.0.30319: ProjectPlanning.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Infragistics4.Win.UltraWinStatusBar.v17.2\v4.0_17.2.20172.2006__7dd5c3163f2cd0cb\Infragistics4.Win.UltraWinStatusBar.v17.2.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Exception thrown: 'System.Data.InvalidConstraintException' in System.Data.dll An exception of type 'System.Data.InvalidConstraintException' occurred in System.Data.dll but was not handled in user code ForeignKeyConstraint Relation1 requires the child key values () to exist in the parent table.
Thanks in advance,
Robbe
Hello Robbe,
I reproduced the exception but I couldn't find a solution.
I have created a support case for you CAS-194783-X7J6S0 with a development ID: 251811 to investigate this further. You could reach your case following the link bellow:
https://es.infragistics.com/my-account/support-activity I will update you via the mentioned case, so if you have any further questions or comments please update your case.
Please note if the "artes" is expected to have nested tasks it could be the relation that is being added isn't working correctly. In fact, if you remove the following line the exception above goes away:
ds.Relations.Add(ds.Tables["Project"].Columns["ProjectKey"], ds.Tables["Tasks"].Columns["ProjectKey"]);
I was doing some research and it's most likely that the parent key column doesn't have a default value ahead of before the relation is created.
It's possible both issues are a result of the same behavior.
Let me know if you have any questions.
Sincerely,
Michael Di FilippoAssociate Software DeveloperInfragistics, Inc.www.infragistics.com/support
Hello Michael,
Thanks for answering, I added a database MDF and LDF file.
https://we.tl/D07X03mzJM
I also don't know why for ProjectKey "artes1" the tasks doesn't all get shown. My guess is that something in the AllProperties is incorrect but I don't know for sure. Hopefully you can find my problem.
Kind Regards,
Hello Robbe,Issues with printing the UltraGantt shouldn't have much to do with the type of DataSource that is used. I would expect any datasource to reproduce the behavior because whether you are performing the ShowDialog method or adding a task resource.
In order for me to isolate the behavior I require a copy of a database. Without your dbo (or sample) that isolates the behavior, it will be difficult to provide you with a viable solution.
Let me know if you have any questions.Sincerely,
Thanks for anwsering. I know the printing of the ultraganttview works because it used to work. I think the problem has something to do with my database communication. I attached a simplified version of my code (database not included). I also get the same error when I'm adding resources to a task (when I press OK). It has something to do with a relation but I can't properly debug it because the error is always generated in code I can't access. So I'm hoping you can find what I'm doing wrong.
IFG_ProjectPlanning.zip
Thank you for contacting Infragistics. I have not seen or read any reports of this behavior occurring elsewhere. Which event is this logic handled in?
You may also want to try swapping lines 28 and 29 before printing.
eg. this.ultraGanttViewPrintDocument1.GanttView = this.ultraGanttView1;printPreview.Document = this.ultraGanttViewPrintDocument1;
I've attached a sample below demonstrating the print preview working with the UltraGantt correctly. Please modify according to your application's specifications and isolate the behavior. I'll review your modifications and investigate this further for you.
PrintGanttView.zip