Subhash Sharma

Subhash Sharma
Subhash Sharma

This is Subhash Sharma(Software Engineer) Blog

Welcome to this blog and find every solution.............

Search This Blog

Software Engineer(Subhash Sharma)

Software Engineer(Subhash Sharma)
Software Engineer

Tuesday, January 11, 2011

DefaultView

//DefaultView:filter a limited number of columns from a table:
//Distinct Data in DataTable with the Field of roleid,roleName,abbreviation........


DataSet infoDS=new DataSet();
DataTable dTable = infoDS.Tables[0].DefaultView.ToTable(true, "roleid", "roleName", "abbreviation");

for (int i = 0; i < dTable.Rows.Count; i++) { if (dTable.Rows.Count > 0)
{
string _RoleId = dTable.Rows[i]["roleid"].ToString();
string _RoleName = dTable.Rows[i]["roleName"].ToString();
string _Abbreviation = dTable.Rows[i]["abbreviation"].ToString();
}
}

No comments:

Post a Comment