data relations question

B

Brad Allison

I have three tables: clubListing, clubCollection and eventDetails. Being a
newbie I am having problems in setting the relations.

The clubListing table contains the fields clubID (primary key) and clubName.
clubCollection contains no primary keys. It contains two columns, clubID
(there can be many) and clubColl. The first table is related to the second
using clubID (one-to-many).

I then throw in the third table which is eventDetails. This table does have
a primary key which is eventID, however this is how I was the tables related
in the dataset:

clubID to clubID to clubColl

In the primary table there can only be one club ID. This is unique. In the
second table there can be many of the same clubIDs containing many clubColl.
Each clubColl can contain many records from the eventDetail table.

I have a data adapter created for each table. I then use the generate
dataset to add the three tables to the dataset. Opening the XML editor, I
create the relations and check the box that says Create Foreign Key
Restraint only.

When the form opens (using a datagrid to display the data), I fill each
table however when it gets to the second fill (for the clubcoll) I get an
error stating "Failed to enable constraints. One or more rows contain values
violating non-null, unique, or foreign-key constraints."

So what am I doing wrong? Ultimately I want the user to be able to see the
original table with the club names, select the + to show that club's
collection, select the + next to a particular collection and then finally
show the details of the event.

Thanks for the information.

Brad Allison
UKC Dog Events
 
B

Brad Allison

I believe the error that was being generated was due to a column in ClubColl
being referenced as binary and it should have been string. I changed that
and now all seems to work just fine.

BTW, I also used typed code to create the data relations and set the "enable
constraints" to false. All seems to work fine.

Brad
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top