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

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

4 Comments

I want to do the validation through c# code .I will be of great help if u could suggest something
i want to use features provided by asp.net like required field validator,range validator etc
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.
Yes. There are. You can try using Interop or NetOffice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.