Retrieve subset of columns

G

Guy

Does anyone know how to retrieve a subset of columns from a dataset?
I keep running into variations of this situation over and over and
have never found a solution. I must have missed some basic feature in
ADO.

I have a dataset with columns A, B and C. I need to pass a recordset
with ONLY columns A and B to another function outside my control.

I end up maintaining two datasets and it's a royal pain. I've found
tons and tons of information on getting subsets of the rows, combining
rows, rows this, rows that. Nothing on columns.

I end up either maintaining two separate datasets and trying to keep
them in synch, or building a second dataset from scratch off of the
first one by doing dataset.columns.add.
 
M

Miha Markic [MVP C#]

Hi Guy,

There is no clean way to do this.
BTW does it has to be datatable?
If not, you could create a wrapper that utilizes DataTable as source and
exposes only necessary columns.
I guess a wrapper could implement IBindingList and it should work.
 

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