I am using the below method to filter some columns from dataset. It's working fine while i put the columns manually. I ll try to do it dynamically while am giving the column name dynamically based on datatable column.
string StrColumn = "FLD_ID#FLD_CNTRY_NAME";
string[] ArrayColumns = StrColumn.Split('#');
string Column = string.Empty;
const string quote = "\"";
for (int i = 0; i < ArrayColumns.Length; i++)
{
Column = Column + quote + ArrayColumns[i].ToString() + quote + ",";
}
DTblData = DTblData.DefaultView.ToTable(false, Column);
Try removing the last "," from your Column
variable before sorting. Also, I believe Column
should look like "FLD_ID,FLD_CNTRY_NAME"
where by your code it turns out like ""FLD_ID","FLD_CNTRY_NAME""
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.