visualsander
Feb 21st, 2005, 10:07 AM
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
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