Author: Apples | Posted on: 6/5/2008 2:54:05 PM | Views : 303

I have a DataTable that contains a column called EventID, which contains only numbers in that column.  I have the events with their id's and values stored in an enum.  Here's how I'm trying to change the values in the datatable:
 
foreach (DataRow thisRow in dt.Rows)
{
foreach (DataColumn thisColumn in dt.Columns)
{
if (thisColumn.ColumnName.Equals("EventID"))
{
int val = Int32.Parse(thisRow[thisColumn].ToString());
EventTypes ET = (EventTypes)val;
thisRow[thisColumn] = ET.ToString();
}
}
} 
It's giving me this error at "thisRow[thisColumn] = ET.ToString();":
Input string was not in a correct format.
  Go to the complete details ...