This is hurting my brain, so thanks to anyone who can help me.
I've inherited some code written using VS2003, vb.net, and .NET 1.1. I had to upgrade it to VS2005, .NET 2.0. During the automatic migration that happened when I opened the project in VS2005, no code was changed aside from the XML dataset (which was auto migrated/upgraded). The user control uses the UltraGrid control (version 4.3) which is bound to an XML dataset, as well as two UltraGridBands. The first band shows all records from "Table1" and the second band shows all child records from "Table2", again represented in a relational XML dataset with a "Table1Table2" relationship.
Dim UltraGridBand1 As Infragistics.Win.UltraWinGrid.UltraGridBand = New Infragistics.Win.UltraWinGrid.UltraGridBand("Table1", -1)
...
Dim UltraGridBand2 As Infragistics.Win.UltraWinGrid.UltraGridBand = New Infragistics.Win.UltraWinGrid.UltraGridBand("Table1Table2", 0)
The end result is a grid which has expandable rows. When you expand the rows of Table1, you see the related rows of Table2.
This is working great in the old code. When I compile it, everything looks perfect. However the new, migrated, .NET 2.0 code does not work. All I'm seeing are the rows from Table1, and when I click on the "+" to expand the band/row, the "+" disappears but shows no related records from Table2.
If anyone has any advice, I would really appreciate it! And if you live in Washington DC, I'll buy you a beer.
If you haven't gotten it working yet here is what I did.
I have a dataset named SERP2 with 4 tables in it:
Serp Plan ---< SerpPlanComponent ---< SerpPlanComponentClass ---< SerpMetric
(where ---< indicates a one to many relationship)
Here's the code:
Private Sub LoadData() Me.SerpPlanTableAdapter1.ClearBeforeFill = False SERP2.EnforceConstraints = False
Using adp As New SERP2TableAdapters.SerpPlanTableAdapter adp.Fill(Me.SERP2.SerpPlan) End Using
Using adp As New SERP2TableAdapters.SerpPlanComponentTableAdapter adp.Fill(Me.SERP2.SerpPlanComponent) End Using
Using adp As New SERP2TableAdapters.SerpPlanComponentClassTableAdapter adp.Fill(Me.SERP2.SerpPlanComponentClass) End Using
Using adp As New SERP2TableAdapters.SerpMetricTableAdapter adp.Fill(Me.SERP2.SerpMetric) End Using
Try Me.SERP2.EnforceConstraints = True Catch ex As Exception MsgBox(CheckForTableErrors(), MsgBoxStyle.Information, "HRPlanning") End Try End Sub
Private Function CheckForTableErrors() As String Dim sError As String = "" Dim nCount As Integer = 0 For Each dtTable As DataTable In Me.HRPlanningTables.Tables If dtTable.HasErrors Then For Each drRow As DataRow In dtTable.GetErrors sError &= dtTable.TableName & "." & drRow.Table.Columns(0).ColumnName & " = " & drRow(0).ToString & " - " & drRow.RowError & vbCrLf nCount += 1 Next End If Next sError = sError.Substring(0, 2000) & " . . ." Return "Errors: " & nCount & vbCrLf & vbCrLf & sError End Function
I hope this helps. And btw... I'm turning on and off EnforceConstraints during the load in order to defer error messages until the end. That way I can trap them and show the user their data sucks. This data comes from another system so I have to deal with data without referential integrity.