dataset merge

  • Thread starter Thread starter Nitromuse
  • Start date Start date
N

Nitromuse

Hello,
I'm trying to merge two datsets which both have a
common keyed column, and getting nowhere. Do I want to
use the keyed column or not? I'm using the following and
have tried all the constraints every which way.

Dataset1.Merge(Dataset2)

Can anyone shed some light on merging, I thought it was
going to be simple, but there I go thinking again.
Thanks
..
 
Hi Nitromuse,

As far as I did it, you need for merging absolute the same scheme,
(So the same key)

And the keys need to be absolute unique in both datasets (the same in
datasetB and datasetB is not allowed)

I am not sure of this, but I thought you can use the merge for 2 different
tables, but than it is almost the same as an add of a table to the dataset.

A very curious situation to use I think.

What it it you want to archieve?

Cor


"> Hello,
 
Please go to the adonet newsgroup for this. It could be answered here, but
you are more likely to get a quick response there as that is where your
question should be.

Regards - OHM

Hello,
I'm trying to merge two datsets which both have a
common keyed column, and getting nowhere. Do I want to
use the keyed column or not? I'm using the following and
have tried all the constraints every which way.

Dataset1.Merge(Dataset2)

Can anyone shed some light on merging, I thought it was
going to be simple, but there I go thinking again.
Thanks
.

Regards - OHM# OneHandedMan{at}BTInternet{dot}com
 
Nitromuse,
As Cor stated the schema's in both datasets need to be the same.

My understanding is: Each DataSet needs at least one Table that has the same
name in both DataSets. That these tables have to have matching columns
(names, types, sizes) in both DataSets. That the Table has the same
PrimaryKey in both DataSets. That the dataset you are merging from needs
pending changes where as the dataset you are merging to it doesn't matter.

Where dsChanges are the changes you want added to dsMain, such as:

Dim dsChanges As DataSet
Dim dsMain As DataSet
dsMain.Merge(dsChanges)

In addition to OHM's suggestion of the ado.net newsgroup. David Sceppa's
book "Microsoft ADO.NET - Core Reference" from MS Press has a section on
using the Merge method. Also I find David's book to be both a good tutorial
to learn ADO.NET plus a good desk reference once you are using ADO.NET.

Hope this helps
Jay
 
microsoft.public.dotnet.framework.adonet




NitroM.... said:
Please give me the URL for ADONET, Ill try them there,
thanx

Regards - OHM# OneHandedMan{at}BTInternet{dot}com
 
NitroM.... said:
Please give me the URL for ADONET, Ill try them there,
thanx

In addition to OHM, if you want to read the docs:

<F1>
VS.NET
.NET Framework
Programming with .NET FRamework
Accessing data with ADO.NET

especially:
Creating and using datasets
Merging dataset contents


I do not know whether your question will be answered there but you can have
a look.

There is also
<F1>
VS.NET
VB and VC#
Accessing data
 
Paul_IV
Please notice that merged Datasets have to be instances of the same
Dataset Class. In solution explorer Dataset class has extension .xsd. In
Sub it has to look something like:
Public Sub UpdateDataSet()

Dim DataSetInstance1 as DataSet_Name = New Dataset_Name
Dim DataSetInstance2 as DataSet_Name = New Dataset_Name

DataSetInstance1.Merge(DataSetInstance2)
DataSetInstance1.AcceptChanges()

End Sub

Let Data Form Wizard to generate code for you and you will see all right
syntax over there.
 
Back
Top