SqlDbType of a table column

  • Thread starter Thread starter Predrag
  • Start date Start date
P

Predrag

Hello.

How can I get SqlDbType of a column in a table in SQL server database?
Parameters:
1. SqlConnection
2. TableName As String
3. ColumnName As String
Return:
type As SqlDbType

Thanks in advance.
- Predrag.
 
Hi Predrag,

There are basically two ways and both will return only database native type.
1. Use OleDbConnection.GetOleDbSchema
2. query sql server's stored procedures which return metadata.

See SqlDbType Enumeration .net help topic on how to map the types.
 
Back
Top