ConstraintException occured

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
Zero-G.
Posts: 398
Joined: Sat 09 Dec 2006 12:20

ConstraintException occured

Post by Zero-G. » Thu 08 Feb 2007 11:33

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

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Fri 09 Feb 2007 07:18

What is the error message?
What are the definitions of your tables?

Zero-G.
Posts: 398
Joined: Sat 09 Dec 2006 12:20

Post by Zero-G. » Fri 09 Feb 2007 10:27

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

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Fri 09 Feb 2007 10:46

OK, i see.

Post Reply