473,385 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Validate csv input

Howdy

I'm trying to validate the content of a csv uploaded to a web page. I imported the csv into a DataSet and now I want to loop through all the elements in the DataSet to validate that each is of the appropriate type. After validation I will loop through the records again and write them to a SQL2000 table using a stored procedure.

My plan for validation is as follows. But I'm not entirely sure how to execute the validations. C# has wonderful built in validation for dropdownlists or textboxes and the like, but I need some help figuring out what to do now that the input does not come from a web control

Thanks for any help

--Terr

foreach (DataRow Rrow in ds.Tables["ImportCSV"].Rows

foreach(DataColumn Ccolumn in ds.Tables["ImportCSV"].Columns
if row item EmployeeNumber is not an integer
Halt loop, display error message
On row x, the EmployeeNumber "(value)" is not an integer
Please verify the EmployeeNumber on row x

if row item First_Name is not an alphanumeric string,
Halt loop, display error message
On row x, the First_Name "(value)" is not an alphanumeric string
Please verify the First_Name on row x

if row item First_Name has more than 30 characters,
Halt loop, display error message
On row x, the First_Name "(value)" has more than 30 characters
Please verify the First_Name on row x

... similar routine for the rest of the columns and rows in the DataSet
}
Nov 18 '05 #1
0 1034

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: mats | last post by:
Hell My problem is that I do not know how to validate input that I let the user type into my datagrid In one grid I let the user to type in a value into a template column - how do I make sure...
0
by: Marina | last post by:
Let's say a user control has a bunch of textboxes. At some point the user control calls Validate to make sure all input is processed. The Validating event is fired, and if the input was invalid,...
1
by: Theadmin77 | last post by:
I have to validate s floats thru a function , but the validation have to be don with a string of 20 characters .... Any idea how to do thatvalidation floats? Any help will be very appreciated...
11
by: TokyoJ | last post by:
I run a small camp in Alaska for kids and my director is asking for a web form. Could someone please have a look and offer some advice on where I'm making mistake(s)? I'm using the RegExp function...
1
by: john.swilting | last post by:
I am not good in Javascript I begin I do not understand why my function does not go I post my code <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">...
1
by: huhuhuhu | last post by:
i am trying to validate radiobutton n checkbox but to no avail. this is the code that i m using to validate radiobutton>> <script language="JavaScript"> function checkForm() { var cgender...
3
by: Max2006 | last post by:
Hi, I have a user control that has a property named "Text" Is there any way that I use a RequiredFieldValidator or CompareValidator to validate my user control's value? I tried it and I...
1
by: SkipNRun | last post by:
I am a novice when comes to JavaScript, AJAX. I am working on a form, which will allow users to update their contact information. In order to make the form flexible, I need to use pull down list. ...
1
by: mbarnhizer | last post by:
Hello All, Trying to figure out how to validate a series of questions on an online test. I am thinking that VB or Javascript is the best route, but your input may make a difference. The site i...
10
mariodavi
by: mariodavi | last post by:
Hi everybody, how to validate input text in the follow: if option combo = 1,2 e 3, input 1 and input 2 must be filled, if one of this values not selected in combo (to be others), filled input...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.