11
I have this code for filling datatable from excel file:
for (int rowIndex = cells.FirstRowIndex; rowIndex <= cells.LastRowIndex; rowIndex++)
{
var values = new List<string>();
foreach (var cell in cells.GetRow(rowIndex))
{
values.Add(cell.Value.StringValue);
}
dataTable.LoadDataRow(values.ToArray(), true);
}
I have problem when cell is not same datatype as I set in table.
How to skip cell which is wrong datatype?
I also know this, but I can't make it work in my case:
foreach //...
{
if //if datatype is not right
{
continue;
}
}