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

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,816
Latest member
nipsseyhussle

Latest Threads

Top