|
-
Jan 30th, 2012, 09:27 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] remove certain columns from datatable
Hi,
A datatable has several fields, i.e. field1, field2, field3, field9, field10, field88...
string strData = "field1, field2, field3, ...";
Question:
looping through the columns of the datatable, I would like to remove the columns in strData.
So the datatable ends up with the following columns:
field9, field10, field88...
HOw is the above done in C# please?
Thanks
-
Jan 30th, 2012, 10:03 AM
#2
Re: remove certain columns from datatable
Are you referring to a dataTable in C# code or a datatable in a database?
If this is c# code, you can use the remove method:
Code:
dataTable.Columns.Remove("field1");
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
-
Jan 30th, 2012, 10:08 AM
#3
Thread Starter
Fanatic Member
Re: remove certain columns from datatable
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
|