Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
735
exception regarding datasource of grid and datarelationship of dataset - Cannot have a relationship between tables in different DataSets.
posted

I am trying to display two datatables with parent-child relationship using grid. The first time display is fine. It comes up with two bands. The problem comes when I try to change the dataset and reuse it for a new grid later. The exception is InvalidContaintException: Cannot have a relationship between tables in different DataSets.

This is what I did: I have one dataset containing two table A & B, with A as parent and B as child in the relationship. I set the datasource of the grid to table A, and the grid display A as Band 0 and B and Band 1. Then,  I delete the relationship, delete table B, recreate table B and add the relationship from A to B again. Now I create a new grid (old grid is not used anymore and get disposed), set the datasource of the new grid to table A. Here is when the exception happens.

Here is callstack:

  System.Data.dll!System.Data.DataRelation.CheckState() + 0x165 bytes 
  System.Data.dll!System.Data.DataRelation.CheckStateForProperty() + 0x21 bytes 
  System.Data.dll!System.Data.DataRelation.ChildTable.get() + 0xa bytes 
  System.Data.dll!System.Data.DataSet.FindTable(System.Data.DataTable baseTable, System.ComponentModel.PropertyDescriptor[] props = {System.ComponentModel.PropertyDescriptor[1]}, int propStart = 0) + 0xbd bytes 
  System.Data.dll!System.Data.DataView.System.ComponentModel.ITypedList.GetItemProperties(System.ComponentModel.PropertyDescriptor[] listAccessors) + 0x57 bytes 
  System.Windows.Forms.dll!System.Windows.Forms.ListBindingHelper.GetListItemProperties(object list, System.ComponentModel.PropertyDescriptor[] listAccessors) + 0x79 bytes 
  System.Windows.Forms.dll!System.Windows.Forms.CurrencyManager.GetItemProperties(System.ComponentModel.PropertyDescriptor[] listAccessors) + 0xa bytes 
  System.Windows.Forms.dll!System.Windows.Forms.RelatedCurrencyManager.GetItemProperties(System.ComponentModel.PropertyDescriptor[] listAccessors) + 0x5a bytes 
  System.Windows.Forms.dll!System.Windows.Forms.RelatedCurrencyManager.GetItemProperties() + 0xa bytes 
  Infragistics2.Win.v8.3.dll!Infragistics.Win.DataBindingUtils.GetItemProperties(System.Windows.Forms.BindingManagerBase bm = {System.Windows.Forms.RelatedCurrencyManager}, Infragistics.Win.DataBindingUtils.ValuePropertyDescriptorCreator customDescriptorCreator = {Method = {System.ComponentModel.PropertyDescriptor GetItemPropertiesCreator(System.Type, System.String)}}) + 0x2a bytes 
> Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.UltraGridBand.GetItemPropertiesHelper() Line 7391 + 0x42 bytes C#
  Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.UltraGridBand.InitColumns(Infragistics.Win.UltraWinGrid.UltraGridBand[] oldBands = null) Line 7485 + 0x8 bytes C#
  Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.UltraGridBand.InitListManager(System.Windows.Forms.BindingManagerBase bindingManager = {System.Windows.Forms.RelatedCurrencyManager}, string dataMember = "securityCashflowRelationship_AsRow", Infragistics.Win.UltraWinGrid.UltraGridBand[] oldBands = null) Line 7001 + 0xb bytes C#
  Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.UltraGridColumn.InitPropertyDescriptor(System.ComponentModel.PropertyDescriptor propertyDescriptor = {System.Data.DataRelationPropertyDescriptor}, Infragistics.Win.UltraWinGrid.UltraGridBand[] oldBands = null) Line 2715 + 0x13 bytes C#
  Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.UltraGridBand.InitColumns(Infragistics.Win.UltraWinGrid.UltraGridBand[] oldBands = null) Line 7695 + 0x10 bytes C#
  Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.UltraGridBand.InitListManager(System.Windows.Forms.BindingManagerBase bindingManager = {System.Windows.Forms.CurrencyManager}, string dataMember = "", Infragistics.Win.UltraWinGrid.UltraGridBand[] oldBands = null) Line 7001 + 0xb bytes C#
  Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.UltraGridLayout.ListManagerUpdated(System.Windows.Forms.BindingManagerBase bindingManager = {System.Windows.Forms.CurrencyManager}) Line 4782 + 0x2b bytes C#
  Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.UltraGridLayout.ListManagerUpdated() Line 4558 + 0x29 bytes C#
  Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.UltraGridBase.Set_ListManager(object newDataSource = {OriginalTable}, string newDataMember = "") Line 2938 + 0x15 bytes C#
  Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.UltraGridBase.VerifyDataSourceAttached() Line 1880 + 0x26 bytes C#
  Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.UltraGridBase.OnCreateControl() Line 1442 + 0x8 bytes C#
  System.Windows.Forms.dll!System.Windows.Forms.Control.CreateControl(bool fIgnoreVisible) + 0x181 bytes 
  System.Windows.Forms.dll!System.Windows.Forms.Control.CreateControl() + 0x24 bytes 
  System.Windows.Forms.dll!System.Windows.Forms.Control.ControlCollection.Add(System.Windows.Forms.Control value = {InteractiveDataFIA.BondEdge.CMSControls.CmsRichGrid}) + 0x147 bytes 

Thanks,

Zongwen