I need to get the data type of a column using the column name. I am coding in C#. The situation is I have a view which converts some dates into varchar so I can better display them (without time to be exact). However, that means the data type for the columns are now incorrect. What I’d like to do is look up a column from a DataTable schema using the column name and then get the datatype of that column. I’d be gathering the actual data type from the main table rather than the view in this case. Ideas?
Share
The
DataTable.Columnsproperty is aDataColumnCollection, which can be indexed by column name to get aDataColumn, which has aDataTypeproperty.