Solved

how to check data type in dataset

Posted on 2008-10-10
7
1,178 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
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 …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

752 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