StrataFrame Forum

DataSet Relations Problem

http://forum.strataframe.net/Topic21578.aspx

By Bill Cunnien - 1/19/2009

Andria Jensen posted the following solution to her relationship problem back in 2006 (topic):





Dim ds As New DataSet

Me.CalcClientBO.FillAll()

Me.ClientInfoBO.FillAll()



ds.Tables.Add(CalcClientBO.CurrentDataTable)

ds.Tables.Add(ClientInfoBO.CurrentDataTable)

ds.Relations.Add("ListRelation", ds.Tables(0).Columns("ClientKey"), ds.Tables(1).Columns("ClientKey"), False)



grdList.DataSource = ds.Tables(0)

grdList.LevelTree.Nodes.Add("ListRelation", gvListDtl)

grdList.RefreshDataSource()





I used the above code as a template for my own. It has been working beautifully until last Friday. For some reason, using Andria's code as reference, the string "ListRelation" is being treated as a custom property of a business object. The code is trying to find the custom field name of "ListRelation" on the business object CalcClientBO. No changes have been made to CalcClientBO since 12/23/2008.



For additional information, here is the message and the stack trace:



Message: "The given item name could not be evaluated. The item 'ListRelation' does not exist on the business object."




Stack Trace: " at MicroFour.StrataFrame.Business.BusinessLayer.GetDescriptor(String FieldName) at MicroFour.StrataFrame.Business.BusinessLayer.GetPropertyDescriptor(String FieldName) at MicroFour.StrataFrame.Business.BusinessBindingSource.BusinessObject_CurrentView_ListChanged(Object sender, ListChangedEventArgs e) at System.ComponentModel.ListChangedEventHandler.Invoke(Object sender, ListChangedEventArgs e) at System.Data.DataView.OnListChanged(ListChangedEventArgs e)"




The grid involved is a DevEx XtraGrid, but I doubt that should matter much.



Can anyone direct me on what to look for to resolve this problem?



Thanks!!

Bill
By Bill Cunnien - 1/19/2009

Resolution:



I decided to add a new reference to the business objects rather than use the business objects assigned to the form during the design-time session. Basically, the code looks as follows:





Dim ds As New DataSet

Dim mBO1 As New CalcClientBO

Dim mBO2 As New ClientInfoBO

Me.mBO1.FillAll()

Me.mBO2.FillAll()



ds.Tables.Add(mBO1.CurrentDataTable)

ds.Tables.Add(mBO2.CurrentDataTable)

ds.Relations.Add("ListRelation", ds.Tables(0).Columns("ClientKey"), ds.Tables(1).Columns("ClientKey"), False)



grdList.DataSource = ds.Tables(0)

grdList.LevelTree.Nodes.Add("ListRelation", gvListDtl)

grdList.RefreshDataSource()





I bypassed the use of the BBS on the form, since that was used mostly for the design-time setup of the grid.



So far, everything seems to be working just fine.



Bill