C validating data types
This article demonstrates how to validate an Excel data without consuming a lot of time.
Getting Started Before starting a demonstration let’s understand about this demonstration.
These two things are the only requirement to validate the data type.
One can make use of compare validator to accomplish the task very easily. To compare whether the entered value is of a particular data type one should make sure that the “Operator” property of compare validator should be “Data Type Check” and the “Type” property should be the data type you want to check.
This demonstration is useful while validating an Excel sheet before uploading it to the server in both web and Windows-based applications.
But here, this demonstration uses Windows-based application and it does not contain Upload coding part, it contains only validation part of coding.
I have already written in the upper part of this article for validating the schema and data.
For validating the schema of Excel sheet, the Validation Type property of class Xml Reader Settings needs to be set Validation Type. The below code is sample example for validating the schema of Excel sheet.It first,reads an Excel sheet's data using OLDB and stores its data into a Dataset, then validates the Excel sheet and displays validation message in error panel if the error exists.