Domanda

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.

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top