G
Guest
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
}
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
}