• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 395
  • Last Modified:

How to get DataType of a column

How can i get a column data type like varchar, char, smallint

DataColumn.DataType.Name returns string for varchar, nvarchar. I want exact data type. How can i get it.
0
ynaina
Asked:
ynaina
1 Solution
 
Juan_BarreraCommented:
'For example, declare a column of type Integer:

Dim dc As New DataColumn
dc.DataType = GetType(Integer)

'Get it's type:

Dim t As Type = dc.DataType

'Then, do something with it:

Dim s As String
 If t Is GetType(Integer) Then
       s = "I'm an Integer"
 Else
       s = "I'm something else"
End If
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now