pk8382
pk8382

Reputation: 21

adding validations to data that is imported through excel file

I want to import excel sheet data which contains fields like Employee Id,Employee Name,Gender,Phone No in first column and their respective value in second column ,and save the data to database. I used oledb connection to import the excel sheet and then put it in a data table. Now i want to add validation in all the fields like Employee ID should be the required field,Employee Name should be alphabet,phone no should be number before saving it to the database.

how can i do the validation??

Upvotes: 1

Views: 5461

Answers (1)

AT-2017
AT-2017

Reputation: 3149

It's a bit of process. So I am not writing anything for this. The following shows a step by step process to validate and how to import data from spreadsheet:

Validate Data While Importing in Sql Server

In this case, you have to create a class to check upon the fields of the spreadsheet. The following should help you to start:

Validate Spreadsheet With C# 1

This one would be perfect:

Validate Spreadsheet With C# 2

Upvotes: 1

Related Questions