Solved

how to check data type in dataset

Posted on 2008-10-10
7
1,159 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
ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

777 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