dataset.merge not working correctly



I am trying to merge two datasets into one, each dataset has one table when
I merge the two datasets I get a dataset with two tables? I need the merged
dataset to only contain one table with the merged data. Does anyone know how
to avoid this?



Thanks, I figured that. I tried it and it works, sort of. It seems that I
can only get this to work by setting the name of the second table to the name
of the first table. Creating / setting primary keys on each table. But then
the only way to get the merge to work is to loop through each record in the
second table, adding each row to an array and merging the array for each row
individually. I don't care that I have to do it this way, see ex.1 below,
I'm just happy that it works. Thank you for your help

ex 1

Me.DsTest21.Tables(0).TableName = "Test1"

Dim pk1(1) As DataColumn
pk1(0) = Me.DsTest11.Tables(0).Columns("TestNumber1")
Me.DsTest11.Tables(0).PrimaryKey = pk1

Dim pk2(1) As DataColumn
pk2(0) = Me.DsTest21.Tables(0).Columns("TestNumber1")
Me.DsTest21.Tables(0).PrimaryKey = pk2

Dim dr As DataRow
For Each dr In Me.DsTest21.Tables(0).Rows
Dim dra(0) As DataRow
dra(0) = dr
Me.DataGrid3.DataSource = Me.DsTest11.Test1

For whatever reason just calling Me.DsTest11.Merge(Me.DsTest21) will not
give me the combined results.

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