-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: MohangandhiC
Message 4 in Discussion

There is a small change required in the bellowed reply:     We cannot copy a 
datatable from a dataset to an another dataset with the command  
InventoryDataSet.Tables.Add( details2dataset.Tables(0) )     This will give you 
the error:   "DataTable already belongs to another DataSet."     Instead you 
can use the following work around:     
InventoryDataSet.Tables.Add(details2dataset.Tables(0).Copy())     This will 
work fine :)   Enjoy!!     Thanks,  MohanGandhi. C     

BDOTNET <[email protected]> wrote:            New Message on BDOTNET    
  How to add Data tables to Dataset

        Reply
             Recommend   Message 3 in
 Discussion             From: contact4manoj     
  Hi Yathish.    
 To create a datatable at any point of time by code using VB.NET (which is what 
you seem to be using, you need to use the following command:     Dim dtDemo as 
New System.Data.DataTable     After which you can declare the various 
DataColumn Objects and add the desired rows.  This datatable can then be added 
directly to the dataset at any point of time, just by issuing the following 
command:     InventoryDataSet.Tables.Add( dtDemo )     But, since you seem to 
be creating a dataset in the two functions, then to transfer a table from one 
dataset to another, there are two ways.     The first technique is to directly 
add the table from dataset created in the function to the other dataset.  Your 
code in the function, would probably read like this:     
InventoryDataSet.Tables.Add( details2dataset.Tables(0) )     But then, this is 
a referential copy.  Meaning, any changes you make to the InventoryDataSet's 
table, will be reflected in the details2dataset table.     The other option, in 
case you do not want a referential copy, but would like a complete copy, is to 
use the datatable's Clone() method, in the following way:     
InventoryDataSet.Tables.Add( details2dataset.Tables(0).Clone() )     Hope the 
above explanation helps.     Yours truly,     MANOJ KUMAR
 SHARMA.
View other groups in this category. 




        Cheers,     MohanGandhi. C<o:p></o:p>   
 

Have a burning question? Go to Yahoo! Answers and get answers from real people 
who know.

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member 
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you 
received this message by mistake, please click the "Remove" link below. On the 
pre-addressed e-mail message that opens, simply click "Send". Your e-mail 
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to