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

Using vb.net 2005, how do I determine the datatype of a column in a typed dataset?

I'm trying to assign values to columns in a dataset, but need to know what the datatype of the column is before I do, so I don't assign in invalid value.

Any ideas?


0
genehayes
Asked:
genehayes
1 Solution
 
PaulHewsCommented:
You can determine a datatype at runtime with code like this:

For Each col As DataColumn In MyDatatable.Columns
    If col.DataType Is GetType(String) Then
        MsgBox(col.ColumnName & " is a string")
    End If
    If col.DataType Is GetType(Integer) Then
        MsgBox(col.ColumnName & " is an integer")
    End If

Next
0
 
genehayesAuthor Commented:
Excellent!  I was working around it, but never quite got there.  Thanks!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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