cpopham 0 Junior Poster in Training

Okay this is a good one I believe. In a dataset, you can create single relations (ParentTable.PrimaryKey to ChildTable.ForignKey) using the dataset.relations.add method. You can use a string variable something like this:

Dataset.Relations.Add("relationName",Dataset.ParentTable.columns(strParentKey),dataset.ChildTable.columns(strchildForeignKey)

This method works fine for single to single keys generated dynamically using schema info.

Now if there are two or more keys involved to make up the primary key, it starts getting a little tricky. If you know all of the columns ahead of time, you can hard code them in. However, I am creating an independant procedure that will generate the relations dynamically.

So I will not know ahead of time is there is a single column primary key or a ten(10) column primary key involved in the relations, but I need to be able to add the columns dynamically to the relations columns collection to account for all of these situations.

Anybody have any ideas?

Thanks, Chester

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.