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
310
Difference between Ultragrid.Wincombobox.SetDataBinding Version 8.3 and 9.2
posted

Normal 0 21 false false false DE X-NONE X-NONE MicrosoftInternetExplorer4

In 2007  I developed an application with Infragistics Components. Last year I have to do some changes in this application and so I made an Upgrade of Version: Infragistics2.Win.UltraWinGrid.v8.3. which where finished at the begining of this year. Every thing works fine.

Now the customer asked me to update to Version: Infragistics2.Win.UltraWinGrid.v9.2 - the upgrade with the Upgrade tool works fine. All things work fine but only one point gives problems.

The point is, when I called second time the function LoadBHDH(). This function is called when the user clicks the button "bearbeiten" and prepare part of the data depending on the choosen IDHieb, which are shown in the registers.

if I call it second time I get the error:

Normal 0 21 false false false DE X-NONE X-NONE MicrosoftInternetExplorer4

Einschränkungen konnten nicht aktiviert werden. Mindestens eine Zeile enthält Werte die die Einschränkungen non-null, unique or foreign-key verletzen.

The function loadBHD:

Private Function loadBHDH() As Boolean
        'Lädt Daten von M2BaKollInfo, M2BHD und M2Höhe, M3GueteStamm, M3GueteIL, M3GueteBHD
        'zu aktuellem Hieb in Datatables und Grids
        Try
            loadBHDH = True
            uneBHD.Hide()
            ucbGutBHD.Show()
            ucbGutBHD.Enabled = True
            If dsvork.Tables.Contains("M3GueteStamm") Then
                dsvork.Tables("M3GueteStamm").Clear()
                daM3GueteStamm.Dispose()
            End If
            If dsvork.Tables.Contains("M3GueteBHD") Then
                dsvork.Tables("M3GueteBHD").Clear()
                daM3GueteBHD.Dispose()
            End If
            If dsvork.Tables.Contains("M3GueteIL") Then
                dsvork.Tables("M3GueteIL").Clear()
                daM3GueteIL.Dispose()
            End If
            If dsvork.Tables.Contains("M2BHD") Then
                dsvork.Tables("M2BHD").Clear()
                daM2BHD.Dispose()
            End If
            If dsvork.Tables.Contains("M2Hoehe") Then
                dsvork.Tables("M2Hoehe").Clear()
                daM2Hoehe.Dispose()
            End If
            If dsvork.Tables.Contains("M2BaKoll") Then
                dsvork.Tables("M2BaKoll").Clear()
                daM2BaKoll.Dispose()
            End If
            If DBConnection1.State = ConnectionState.Closed Then DBConnection1.Open()
            'Bakollinfo
            strsql = "SELECT IDHieb, IDBa, IDKollektiv, HoehenArtID, mBHD_cmmR, mHoehe_m, SLaenge, EinheitSLID, HStufeID, FStufeID, " & _
            " SchaetzartID, Aushieb, EinheitAushiebID, VerteilungsbreiteID, BHDVonBis, BHDAbrundenID, MessHoehe_m, KurvenNr, EKluppe, " & _
            " BaumIDfremd, M3_XholzBHD_cmmR, M3_XholzAnteil_pz, M3_XholzLaenge_m, M3_KbruchAnt_pz, M3_BHDMin_cmmR, M3_AzopfMin_cmmR, " & _
            " M3_BHDMax_cmmR, M3_AzopfMax_cmmR, M3_TLaenge_m, M3_KroneNutz_pz, M3_GueteLaengeID, BHDvon, BHDbis " & _
            " FROM M2BaKollInfo WHERE (IDHieb = " & ucbHiebID.Value & ")" & _
            " ORDER BY IDBa, IDKollektiv"
            daM2BaKoll = New OleDb.OleDbDataAdapter(strsql, DBConnection1)
            daM2BaKoll.MissingSchemaAction = MissingSchemaAction.AddWithKey
            dcbM2BaKoll = New OleDb.OleDbCommandBuilder(daM2BaKoll)
            daM2BaKoll.InsertCommand = dcbM2BaKoll.GetInsertCommand
            daM2BaKoll.UpdateCommand = dcbM2BaKoll.GetUpdateCommand
            daM2BaKoll.DeleteCommand = dcbM2BaKoll.GetDeleteCommand
            daM2BaKoll.InsertCommand.Connection = DBConnection1
            daM2BaKoll.UpdateCommand.Connection = DBConnection1
            daM2BaKoll.DeleteCommand.Connection = DBConnection1
            daM2BaKoll.Fill(dsvork, "M2BaKoll")
            ugrBHDuH.DataSource = dsvork.Tables("M2BaKoll")
            'BHD-Angaben füllen
            strsql = "SELECT IDHieb, IDBa, IDKollektiv, BHD_cmmR, AstfreieSL_m, Anzahl FROM M2BHD " & _
            "WHERE (IDHieb = " & ucbHiebID.Value & ")"
            daM2BHD = New OleDb.OleDbDataAdapter(strsql, DBConnection1)
            daM2BHD.MissingSchemaAction = MissingSchemaAction.AddWithKey
            dcbM2BHD = New OleDb.OleDbCommandBuilder(daM2BHD)
            daM2BHD.InsertCommand = dcbM2BHD.GetInsertCommand
            daM2BHD.DeleteCommand = dcbM2BHD.GetDeleteCommand
            daM2BHD.UpdateCommand = dcbM2BHD.GetUpdateCommand
            daM2BHD.InsertCommand.Connection = DBConnection1
            daM2BHD.DeleteCommand.Connection = DBConnection1
            daM2BHD.UpdateCommand.Connection = DBConnection1
            daM2BHD.Fill(dsvork, "M2BHD")
            ugrBHDVert.DataSource = dsvork.Tables("M2BHD")
            'Höhe füllen
            strsql = "SELECT IDHieb, IDBa, IDKollektiv, IDBHD, BHD_cmmR, Hoehe_m " & _
            " FROM M2Hoehe WHERE (IDHieb = " & ucbHiebID.Value & ") ORDER BY IDHieb, IDBa, IDKollektiv, IDBHD"
            daM2Hoehe = New OleDb.OleDbDataAdapter(strsql, DBConnection1)
            daM2Hoehe.MissingSchemaAction = MissingSchemaAction.AddWithKey
            dcbM2Hoehe = New OleDb.OleDbCommandBuilder(daM2Hoehe)
            daM2Hoehe.InsertCommand = dcbM2Hoehe.GetInsertCommand
            daM2Hoehe.DeleteCommand = dcbM2Hoehe.GetDeleteCommand
            daM2Hoehe.UpdateCommand = dcbM2Hoehe.GetUpdateCommand
            daM2Hoehe.InsertCommand.Connection = DBConnection1
            daM2Hoehe.DeleteCommand.Connection = DBConnection1
            daM2Hoehe.UpdateCommand.Connection = DBConnection1
            daM2Hoehe.Fill(dsvork, "M2Hoehe")
            ugrHoehe.DataSource = dsvork.Tables("M2Hoehe")
            If dsvork.Tables("M2BaKoll").Rows.Count > 0 Then
                'Maske füllen - Filter auf Grids legen - nur wenn Daten vorhanden !! nicht bei Neuanlage
                ugrBHDuH.ActiveRow = ugrBHDuH.Rows(0)                  '1.Zeile = 1. Baumart
                ugrBHDuH.ActiveRow.Selected() = True
            End If
            'M3GueteBHD
            strsql = "SELECT IDHieb, IDBa, IDKollektiv, IDBHD, IDHerkunft, IDGQual " & _
            " FROM M3GueteBHD WHERE (IDHieb = " & ucbHiebID.Value & ") ORDER BY IDHieb, IDBa, IDKollektiv, IDBHD"
            daM3GueteBHD = New OleDb.OleDbDataAdapter(strsql, DBConnection1)
            daM3GueteBHD.MissingSchemaAction = MissingSchemaAction.AddWithKey
            dcbM3GueteBHD = New OleDb.OleDbCommandBuilder(daM3GueteBHD)
            daM3GueteBHD.InsertCommand = dcbM3GueteBHD.GetInsertCommand
            daM3GueteBHD.DeleteCommand = dcbM3GueteBHD.GetDeleteCommand
            daM3GueteBHD.UpdateCommand = dcbM3GueteBHD.GetUpdateCommand
            daM3GueteBHD.InsertCommand.Connection = DBConnection1
            daM3GueteBHD.DeleteCommand.Connection = DBConnection1
            daM3GueteBHD.UpdateCommand.Connection = DBConnection1
            daM3GueteBHD.Fill(dsvork, "M3GueteBHD")
            'M3GueteStamm
            strsql = "SELECT IDHieb, IDBa, IDKollektiv, IDBHD, IDGueteKoll, StammAnt_pz, GueteID1, Laenge1_m,  " & _
            " GueteID2, Laenge2_m, GueteID3 " & _
            " FROM M3GueteStamm WHERE (IDHieb = " & ucbHiebID.Value & ") ORDER BY IDHieb, IDBa, IDKollektiv, IDBHD, IDGueteKoll"
            daM3GueteStamm = New OleDb.OleDbDataAdapter(strsql, DBConnection1)
            daM3GueteStamm.MissingSchemaAction = MissingSchemaAction.AddWithKey
            dcbM3GueteStamm = New OleDb.OleDbCommandBuilder(daM3GueteStamm)
            daM3GueteStamm.InsertCommand = dcbM3GueteStamm.GetInsertCommand
            daM3GueteStamm.DeleteCommand = dcbM3GueteStamm.GetDeleteCommand
            daM3GueteStamm.UpdateCommand = dcbM3GueteStamm.GetUpdateCommand
            daM3GueteStamm.InsertCommand.Connection = DBConnection1
            daM3GueteStamm.DeleteCommand.Connection = DBConnection1
            daM3GueteStamm.UpdateCommand.Connection = DBConnection1
            daM3GueteStamm.Fill(dsvork, "M3GueteStamm")
            'M3GueteIL
            strsql = "SELECT IDHieb, IDBa, IDKollektiv, IDGuete, StammAnt_pz, IDHerkunft, IDGQual " & _
            " FROM M3GueteIL WHERE (IDHieb = " & ucbHiebID.Value & ") ORDER BY IDHieb, IDBa, IDKollektiv"
            daM3GueteIL = New OleDb.OleDbDataAdapter(strsql, DBConnection1)
            daM3GueteIL.MissingSchemaAction = MissingSchemaAction.AddWithKey
            dcbM3GueteIL = New OleDb.OleDbCommandBuilder(daM3GueteIL)
            daM3GueteIL.InsertCommand = dcbM3GueteIL.GetInsertCommand
            daM3GueteIL.DeleteCommand = dcbM3GueteIL.GetDeleteCommand
            daM3GueteIL.UpdateCommand = dcbM3GueteIL.GetUpdateCommand
            daM3GueteIL.InsertCommand.Connection = DBConnection1
            daM3GueteIL.DeleteCommand.Connection = DBConnection1
            daM3GueteIL.UpdateCommand.Connection = DBConnection1
            daM3GueteIL.Fill(dsvork, "M3GueteIL")
            'Relationen definieren für Güteklassen
            If Not dsvork.Relations.Contains("M2BaKollM3GueteIL") Then
                parentCol2(0) = dsvork.Tables("M2BaKoll").Columns("IDHieb")
                parentCol2(1) = dsvork.Tables("M2BaKoll").Columns("IDBa")
                parentCol2(2) = dsvork.Tables("M2BaKoll").Columns("IDKollektiv")
                childCol2(0) = dsvork.Tables("M3GueteIL").Columns("IDHieb")
                childCol2(1) = dsvork.Tables("M3GueteIL").Columns("IDBa")
                childCol2(2) = dsvork.Tables("M3GueteIL").Columns("IDKollektiv")
                myDataRelation = New DataRelation("M2BaKollM3GueteIL", parentCol2, childCol2)
                dsvork.Relations.Add(myDataRelation)
            End If
            If Not dsvork.Relations.Contains("M2BaKollM3GueteBHD") Then
                parentCol1(0) = dsvork.Tables("M2BaKoll").Columns("IDHieb")
                parentCol1(1) = dsvork.Tables("M2BaKoll").Columns("IDBa")
                parentCol1(2) = dsvork.Tables("M2BaKoll").Columns("IDKollektiv")
                childCol1(0) = dsvork.Tables("M3GueteBHD").Columns("IDHieb")
                childCol1(1) = dsvork.Tables("M3GueteBHD").Columns("IDBa")
                childCol1(2) = dsvork.Tables("M3GueteBHD").Columns("IDKollektiv")
                myDataRelation = New DataRelation("M2BaKollM3GueteBHD", parentCol1, childCol1)
                dsvork.Relations.Add(myDataRelation)
            End If
            If Not dsvork.Relations.Contains("M3GueteBHDM3GueteStamm") Then
                parentCol3(0) = dsvork.Tables("M3GueteBHD").Columns("IDHieb")
                parentCol3(1) = dsvork.Tables("M3GueteBHD").Columns("IDBa")
                parentCol3(2) = dsvork.Tables("M3GueteBHD").Columns("IDKollektiv")
                parentCol3(3) = dsvork.Tables("M3GueteBHD").Columns("IDBHD")
                childCol3(0) = dsvork.Tables("M3GueteStamm").Columns("IDHieb")
                childCol3(1) = dsvork.Tables("M3GueteStamm").Columns("IDBa")
                childCol3(2) = dsvork.Tables("M3GueteStamm").Columns("IDKollektiv")
                childCol3(3) = dsvork.Tables("M3GueteStamm").Columns("IDBHD")
                myDataRelation = New DataRelation("M3GueteBHDM3GueteStamm", parentCol3, childCol3)
                dsvork.Relations.Add(myDataRelation)
                'Datenbindung zum Grid - nur einmal definieren - verliert sonst Layout-Darstellungen
                ugrGute.SetDataBinding(dsvork, "M2BAKoll")
                'Bindung zur Kombobox
                ucbGutBA.DataBindings.Add("Value", ugrGute.DataSource, "M2BAKoll.IDBa")
                uneKollG.DataBindings.Add("Value", ugrGute.DataSource, "M2BAKoll.IDKollektiv")
                ucbgutQual.DataBindings.Add("Value", ugrGute.DataSource, "M2BaKoll.M2BaKollM3GueteBHD.IDGQual")
                lblmHoeh.DataBindings.Add("Text", ugrGute.DataSource, "M2BaKoll.mHoehe_m")
                ucbexlang.DataBindings.Add("Value", ugrGute.DataSource, "M2BAKoll.M3_XholzBHD_cmmR")
                ucbeStpr.DataBindings.Add("Value", ugrGute.DataSource, "M2BAKoll.M3_XholzAnteil_pz")
                ucbeStLang.DataBindings.Add("Value", ugrGute.DataSource, "M2BAKoll.M3_XholzLaenge_m")
                ucbeKrBr.DataBindings.Add("Value", ugrGute.DataSource, "M2BAKoll.M3_KbruchAnt_pz")
                lblBHDvG.DataBindings.Add("Text", ugrGute.DataSource, "M2BAKoll.M3_BHDMin_cmmR")
                ucbeBHDv.DataBindings.Add("Value", ugrGute.DataSource, "M2BAKoll.M3_AZopfMin_cmmR")
                lblBHDbG.DataBindings.Add("Text", ugrGute.DataSource, "M2BAKoll.M3_BHDMax_cmmR")
                ucbeBHDb.DataBindings.Add("Value", ugrGute.DataSource, "M2BAKoll.M3_AZopfMax_cmmR")
                ucbeTransl.DataBindings.Add("Value", ugrGute.DataSource, "M2BAKoll.M3_TLaenge_m")
                ucbeKroneNz.DataBindings.Add("Value", ugrGute.DataSource, "M2BAKoll.M3_KroneNutz_pz")
                ucbGutLang.DataBindings.Add("Value", ugrGute.DataSource, "M2BAKoll.M3_GueteLaengeID")
                ucbGutBHD.SetDataBinding(dsvork, "M2BaKoll.M2BaKollM3GueteBHD")
                ucbGutBHD.SyncWithCurrencyManager = True
                ucbGutBHD.ValueMember = "IDBHD"
                ucbGutBHD.DisplayMember = "IDBHD"
                ugrGutIL.DataSource = dsvork.Tables("M3GueteIL")
                ugrGutIL.SetDataBinding(dsvork, "M2BaKoll.M2BaKollM3GueteIL")
            End If
        Catch myex As Exception
            MsgBox(myex.Message)
            loadBHDH = False
        Finally
            If DBConnection1.State = ConnectionState.Open Then DBConnection1.Close()
        End Try
    End Function

 

The error occures by

            daM2BaKoll.Fill(dsvork, "M2BaKoll")

If I comment the part:

ucbGutBHD.SetDataBinding(dsvork, "M2BaKoll.M2BaKollM3GueteBHD")
ucbGutBHD.SyncWithCurrencyManager = True
ucbGutBHD.ValueMember = "IDBHD"
ucbGutBHD.DisplayMember = "IDBHD"

it works, but I do not get the Datas für Ultra.wincombo.Box ucbGutBHD.

Although seldom is: When I have a look in the preview of the dataset dsvork before calling the fill-Statement (daM2BaKoll.Fill(dsvork, "M2BaKoll") all the tables are empty. After getting the error the table M3GueteBHD has one record but without the fourth parameter for BHD. And there should not be a record inside before loading this table because it was cleared.

Is there any idea about this problem?

 


 


Parents
No Data
Reply
  • 469350
    Offline posted

    Hi,

    It's hard to follow what's going on here, but it sounds like the error message you are getting is related to the population of your data source and not the UltraCombo. I can't see any way that the Infragistics controls could possibly have any effect on this.

    But maybe I am wrong, since I can't really read the error message, since it's not in English. The only parts I can read mention a foreign-key which says to me that this error has something to do with the relationships in the data set.

    It might help if you could post the entire call stack of the error, so I can see where it's coming from.

    Also, you might want to make sure you have the latest service release for NetAdvantage.

    How to get the latest service release - Infragistics Community

Children
No Data