Solved

how to check data type in dataset

Posted on 2008-10-10
7
1,132 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
Comment Utility
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
Comment Utility
Dataset1.Tables.Columns("column_nr").DataType
0
 
LVL 4

Author Comment

by:CraigLazar
Comment Utility
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 16

Expert Comment

by:Gyanendra Singh
Comment Utility
yes
0
 
LVL 16

Accepted Solution

by:
Gyanendra Singh earned 125 total points
Comment Utility
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
Comment Utility
Thanks allot for the help
0
 
LVL 16

Expert Comment

by:Gyanendra Singh
Comment Utility
your welcome
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 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

9 Experts available now in Live!

Get 1:1 Help Now