1

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??

pk8382
  • 21
  • 1
  • 6

1 Answers1

1

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

Community
  • 1
  • 1
AT-2017
  • 3,114
  • 3
  • 23
  • 39
  • I want to do the validation through c# code .I will be of great help if u could suggest something – pk8382 Oct 15 '16 at 07:57
  • i want to use features provided by asp.net like required field validator,range validator etc – pk8382 Oct 15 '16 at 07:58
  • I am doing it in asp.net .is there any inbuild library by Microsoft by which i can do it easily without writing long logics. – pk8382 Oct 16 '16 at 05:38
  • Yes. There are. You can try using `Interop` or `NetOffice`. – AT-2017 Oct 16 '16 at 06:16