How to discover that a DataColumn's underlying datatype is xml

truedarkzone

New Member
I have a SQL Server data table that has an xml column. I run a select query using \[code\]DataTable\[/code\] (\[code\]Fill\[/code\] method of the \[code\]SqlDataAdapter\[/code\] class). After execution, the type of the column is \[code\]string\[/code\]. I am wondering how I could determine the actual SQL Server datatype (in this case \[code\]xml\[/code\]) from the \[code\]DataTable\[/code\] materialized by the \[code\]Fill\[/code\] method.I cannot use \[code\]SqlDataReader\[/code\] (which has \[code\]GetSchemaTable\[/code\] method that returns the SQL Server datatype information) - I have to use \[code\]SqlDataAdapter/DataTable\[/code\]. Doing something like:\[code\]DataTableReader reader = new DataTableReader(table);DataTable schemaTable = reader.GetSchemaTable();\[/code\]is also not helpful since it also does not seem to contain the SQL Server datatype information.
 
Back
Top