dataset casting (merge)

G

Guest

How can I cast the dataset

I generated the dataset from schema and named it 'Staff'. I use this dataset (staff dataset) as a datasource in the report

then I would like to generate the data from Staff dataset, here is the logic

Dim ds as DataSe
Dim ds2 as DataSet

ds = sqlhelper.ExecuteDataSet (....) //Get data from store proces, this line is o
msgbox(ds.tables(0).rows.count) //return x row

ds2 = new Staff //compiled

ds2.Merge (ds) //compiled but return not row
msgbox (ds2.tables(0).rows.count) //return

How can I get the ds2 returning the same rows as ds? Can anyone help?
 
G

Guest

Ignore my above questions. I already found out what's wrong. The datatype of the dataset returned by sql server is not the same with dataset created by the schema.
 
C

Cor

Hi Bernard,

For the merge in the same tables, they need to have the same schema.

If you want exactly the same dataset you can use the dataset.copy

If you want to have a part you can use a dataset.clone and than add the rows
by using the dataview, a table.select or a find.

However you cannot add a datarow which is already attached to one dataset
attach to another, but trasporting the data creating newdatarows in the new
tables and filling that with either the itemarray or the items is no
problem.

(In other words you have to use a for loop if it is not the complete
dataset)

Cor
 
G

Guest

For the merge in the same tables, they need to have the same schema

This isn't exactly true. You can specify whether to add missing schema or not
(In other words you have to use a for loop if it is not the complet
dataset

Can't you merge datarow array also


----- Cor wrote: ----

Hi Bernard

For the merge in the same tables, they need to have the same schema

If you want exactly the same dataset you can use the dataset.cop

If you want to have a part you can use a dataset.clone and than add the row
by using the dataview, a table.select or a find

However you cannot add a datarow which is already attached to one datase
attach to another, but trasporting the data creating newdatarows in the ne
tables and filling that with either the itemarray or the items is n
problem

(In other words you have to use a for loop if it is not the complet
dataset

Co
 

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

Similar Threads


Top