I am having an error using the following code,
DataView dtView = new DataView(dt);
columname = "ItemNo";
Cond procedure = Cond.checknum; //I had a public enum Cond { checknum, checkspace }
procedure.Equals(null); //Null because I am changing the procedure below in the program
List<string> Mapcol = new List<string>();
foreach (string cols in dt.Columns)
{ Mapcol.Add(cols); }
dtView.Sort = Mapcol.Contains(columname)+ " ASC";
I am retriving data from a .csv and is already at the DataTable called dt... But I am unable to pass the columns to the ColumnMap list...
Error = Unable to cast object of type 'System.Data.DataColumn' to type 'System.String'.