Add datatable to dataset

C

Cc

hi
i create a function in a module that return datatable , then I intent to add
the data table to a dataset but it give me error "datatable already belong
to a dataset". is this mean datatable pass by ref . if so how do I make it
pass by value?
 
J

Jerry

Think of a dataset as the house your datatables and their constraints live
in. You wouldn't want to pass a reference to a table when you can pass the
reference to the whole dataset. Your dataset is being passed by reference
and when you try to put it into a newly created dataset the program fails.
A table can no more exist in two datasets than your bed can be in two houses
at once. If you pass the reference to your entire dataset around to the
different classes which you are using to act on them I think you will have
better success.
 

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