Code Snippet posted by:
Sabarimahesh | Posted on: 6/14/2012 | Category:
C# Codes | Views: 665 | Status:
[Member] |
Points: 40
|
Alert Moderator
using System.Data;
using System.Linq;
DataTable dt = ds.Tables[0];
DataView dv = new DataView(dt);
string cols = string.Empty;
foreach (DataColumn col in dt.Columns)
{
if (!string.IsNullOrEmpty(cols)) cols += ",";
cols += col.ColumnName;
}
dt = dv.ToTable(true, cols.Split(','));
ds.Tables.RemoveAt(0);
ds.Tables.Add(dt);
Life is a Race
Thanks & Regards
By
Sabari Mahesh P M