Page 1 of 1

ConstraintException occured

Posted: Thu 08 Feb 2007 11:33
by Zero-G.
Hey
So, I have insert into my project a DataSet through the DataSet Wizzard. - The DataSet has a master table with two relations.
I do the following code:

Code: Select all

Try
            Me.KundenstammTableAdapter.Fill(Me.DtsÜbersicht.kundenstamm, KundenNr)
        Catch ex As System.Exception
            System.Windows.Forms.MessageBox.Show(ex.Message)
        End Try
        Me.DtsÜbersicht.EnforceConstraints = True
        'TODO: This line of code loads data into the 'DtsÜbersicht.kontaktlinse' table. You can move, or remove it, as needed.
'Here I get the Error (ConstraintException occured)
        Me.KontaktlinseTableAdapter.Fill(Me.DtsÜbersicht.kontaktlinse)
        'TODO: This line of code loads data into the 'DtsÜbersicht.brille' table. You can move, or remove it, as needed.
        Me.BrilleTableAdapter.Fill(Me.DtsÜbersicht.brille)
        'TODO: This line of code loads data into the 'DtsÜbersicht.handelsware' table. You can move, or remove it, as needed.
        Me.HandelswareTableAdapter.Fill(Me.DtsÜbersicht.handelsware)
The problem is, that when I do first BrilleTableAdapter.Fill, then I get the error there. - And when I go ahead, everything works fine. - What can the problem be?

THX

Posted: Fri 09 Feb 2007 07:18
by Alexey
What is the error message?
What are the definitions of your tables?

Posted: Fri 09 Feb 2007 10:27
by Zero-G.
Hey

I found the problem by myself.

I had to set

Code: Select all

Me.DtsÜbersicht.EnforceConstraints = 
to False. Then everything works fine.

THX

Posted: Fri 09 Feb 2007 10:46
by Alexey
OK, i see.