|
-
Feb 21st, 2005, 11:07 AM
#1
Thread Starter
Hyperactive Member
Add datatables to dataset???
Hi group,
i want to add datatables to a dataset in C#. I checked with msdn and they came up with:
DataSet dataset = new DataSet();
dataset.Tables.Add("aaa");
dataset.Tables.Add("AAA");
So I tried the following:
DataSet ds = new DataSet();
cEmployee emp = new cEmployee();
ds.tables.Add(emp.List);
cCompany comp = new cComp();
ds.tables.add(comp.List);
The List() method fills a dataset with a datatable:
----------------------------------------
here's the partial code:
----------------------------------------
...
DataSet dstemp = new DataSet();
adapter.Fill(dstemp,this.tablename);
return dstemp.tables[This.tablename]
----------------------------------------
I keep getting the error:
DataTable already belongs to a dataset
Does anybody know what I'm doing wrong?
TIA
Regards,
visualsander
-
Feb 22nd, 2005, 12:32 PM
#2
I wonder how many charact
Re: Add datatables to dataset???
As the error so esquisitely mentions - the table already belongs to a dataset. So basically, like a god handing out lives, you can't take someone elses and try to call it your own.
Since I forgot to bring my omniscient powers to work today - you'll have to post the rest of your code.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|