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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top