Verfahren mit Datasets

N

Nijazi Halimaji

Hallo Newsgroup

Ich habe ein kleines logisches problem das ich nicht allzu kompliziert lösen
möchte, deshalb wende ich mich an Euch.

Ich habe einen Dataset der alle Daten enthält.

Ich verarbeite den Dataset (wie auch immer) und habe am Ende einen Arry mit
Schlüsselwerten aus dem Dataset.

Nun möchte ich alle Rows aus dem Dataset, welche in diesem Array sind in ein
eigenes Dataset speichern und diese aus dem ürsprünglichen Dataset löschen.

Am Ende sollte ich zwei Datasets haben die in der Summe dem ursprünglichen
Dataset entsprechen.

Danke für jeden Tipp

Nijazi Halimaji
 
C

Cor Ligthert [MVP]

Nijazi,

You have only one problem and that has to do with the way a dataset is
build.

A dataset holds datatables (references too as a collection)
A datatable has a reference to the dataset that holds it.

Therefore a datatable can only exist in one datataset.

Luckily you can clone and copy a dataset. In your case something as this

dim dsOld as dataset = olddataset
dim dsNew as new dataset

dsNew.Tables.Add(dsOld.Table(0).clone 'to get the first table structure.
or
dsNew.Tables.Add(dsOld.Table(0).copy 'to get everything from that

A way to use that you can see here (in 2005 there is a method for this
bellow)

http://www.windowsformsdatagridhelp.com/default.aspx?ID=655b418e-8e9d-4303-8be7-d6ad9bebf57f

And please ask next time in English in these newsgroup. For a lot of us is
English not our native language.

I hope this helps,

Cor
 

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

Top