Importing a spreadsheet I populated a DataTable with this data and returned the expected results.
Trying to put this in a format, I can easily request a search for problem records. I did the following
public void Something(DataTable dt)
{
var data = from row in dt.AsEnumerable()
select row["Order"].ToString();
}
Works as expected, giving me a list of orders. However, I cannot add other fields to this EnumerableRowCollection. Trying to add other fields as follows gives me an error
public void Something(DataTable dt)
{
var data = from row in dt.AsEnumerable()
select row["Order"].ToString(), row["Version"].ToString();
}
Error: "A local variable with the name" string "cannot be declared in this area, because it would give a different value to" row ", which is already used in the" child "area to donate something else"
I think I need an alias for the column name, but I'm out of luck. What am I missing here?