Problems with DataaRelation

L

Lars Netzel

Hi! I

Im having problems adding a DataRelation to the RelationCollection of a datatable in a dataset (filled from an SQL server) .

'**************************'

Dim myRelation As New DataRelation("ActivityMembers", dsActivities.Tables(0).Columns("PROJACTIVITY_ID"), dsActivities.Tables(1).Columns("PROJACTIVITY_ID"))

dsActivities.Relations.Add(myRelation)

'********************************

The Second row gives the error "This constraint cannot be enabled as not all values have corresponding parent values".

This only happens if the Childtable, Table(1), does'nt contain any posts. If I do have some post the relation works fine. but I can't asume I will have Items in the Child Table, how do I fix this?

Best Regards

/Lars
 
G

Guest

I managed to get it working.. you need to set the createConstraints flag to
false
just add (,false) to your datarelation
 

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

Members online

No members online now.

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,111
Latest member
KetoBurn
Top