I have a large database and want to implement a feature which would allow a user to do a bulk update of information. The user downloads an excel file, makes the changes and the system accepts the excel file.
- The user uses a web interface (ASP.NET) to download the data from database to Excel.
- User modifies the Excel file. Only certain data is allowed to be modified as other map into the DB.
- Once the user is happy with their changes they upload the changed Excel file through the ASP.NET interface.
- Now it's the server's job to suck data from the Excel file (using Gembox) and validate the data against the database (this is where I'm having the trouble)
- Validation results are shown on another ASP.NET page after validation is complete. Validation is soft and so hard fails only occur when say an index mapping into DB is missing. (Missing data causes ignore, etc)
- User can decide whether the actions that will be taken are appropriate, in accepting these the system will apply the changes. (Add, Modify, or Ignore)
Before applying the changes and/or additions the user has made, the data must be validated to avoid mistakes by the user. (The accidentally deleted dates which they didn't mean to)
It's not far fetched for the rows that need updating to reach over 65k.
The question is: What is the best way to parse the data to do validation and to build up the change and addition sets?
If I load all data that the excel data must be validated against into memory I might unnecessarily be affecting the already memory hungry application. If I do a database hit for every tuple in the excel file I am looking at over 65k database hits.
Help?