Click here to Skip to main content
15,935,728 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi,

i have a asp.net application in which i want to validate datatable rows and check if it matches datatype present in sql server table.If it doesnt match it should remove the particular row and after filtering invalid rows ,with new datatable i should insert into database using sqlbulkcopy.Basically the data comes from excel spreadsheet which contains thousands of records which is converted to datatable and inserted using sqlbulkcopy.Could any one help on this.It is very urgent.


Thanks,
Dwarak
Posted

I don't see what's stopping you?

Read the rows one-by-one... and based on the validity add the valid row to a datatable. Once the datatable is ready send it for an update.

You said it's urgent, give it a try!
 
Share this answer
 
Hi,

I think you are saying to iterate each row and filter it out.But i want to know how can we check each column in datarow whether it matches the datatype of sql table. could you give any code on this.

Thanks
Dwarak
 
Share this answer
 
Thanks sandeep i got the answer.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900