Solved

how to check data type in dataset

Posted on 2008-10-10
7
1,146 Views
Last Modified: 2012-05-05
Hi,

I simply need to test the datatypes in a datatable in my dataset in vb.net.
I need to check that there are no invalid values in my total columns.
I am reading in an xml file into a dataset, does it automatically assign the datatype to the coulmn based on the values in the xml file?


thanks allot
0
Comment
Question by:CraigLazar
  • 4
  • 2
7 Comments
 
LVL 16

Expert Comment

by:Gyanendra Singh
ID: 22685675
see you need to apply loop on datacolumn and use below property to find the datatype

 Yourcolumnname.DataType
0
 
LVL 8

Expert Comment

by:tiagosalgado
ID: 22686608
Dataset1.Tables.Columns("column_nr").DataType
0
 
LVL 4

Author Comment

by:CraigLazar
ID: 22687426
hi, ok this maybe a stupid question, but from what i understand from the above posts, that if i use this command it will tell me that the column has been assigned in the dataset for the datatable when it read in the xnl file?
so lets say there are 5 rows in the dataset, and column1 has 4 number values and 1 string value, would then the above command return as a string datatype?

then what datatpye do i declare and assign this function to so i can see the datatype?
thanks
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 16

Expert Comment

by:Gyanendra Singh
ID: 22692676
yes
0
 
LVL 16

Accepted Solution

by:
Gyanendra Singh earned 125 total points
ID: 22692686
Its return "Type" Object
refer this link for details
http://msdn.microsoft.com/en-us/library/system.data.datatable.aspx
0
 
LVL 4

Author Closing Comment

by:CraigLazar
ID: 31504945
Thanks allot for the help
0
 
LVL 16

Expert Comment

by:Gyanendra Singh
ID: 22700248
your welcome
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now