Question

I have the following code

csvWriter.WriteField<string>(row.Field<string>(column.ColumnName));

When the row.Field encounters a data of type int, an error is raised.

Is there a way around this? How can I cast the data from an int to a string in this case.

Était-ce utile?

La solution

I suggest you to try something like...

csvWriter.WriteField<string>(row.Field<int>(column.ColumnName).ToString());

... when you need to retrieve the value of an int column.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top