Add datatable to dataset

  • Thread starter Thread starter Cc
  • Start date Start date
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?
 
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.
 
Back
Top