Re: [2005] ASP.NET and Excel
Quote:
Originally Posted by Blakk_Majik
I was told I should sort the spreadsheet by a unique column, and then do my comparison. I would then compare the first row to the 2nd row, the 2nd row to the third row, and so on.
That actually wouldn't find duplicates unless they were next to each other. The way that should have been explained would be "compare the first row to the 2nd row, the 1st row to the 3rd row, etc).
Now on to the problem at hand. Do you have any control over how or when the data is loaded? If so then this can easily be solved by calling a different SQL query (if it's SQL) and doing a DISTINCT. If you don't have control over it, then what is it being loaded into? A DataGrid? If it's a DataGrid you may be able to do a SQL query into it with DISTINCT.
Other than that I'm not sure of a more efficient way. I like to take care of this before the data hits the application.
Re: [2005] ASP.NET and Excel
When a user uploads a spreadsheet, it is held in a temporary folder while the application reads it. Once the application is done reading the data, the sheet is deleted from the temporary folder and the collection of data from the sheet is bound to a datagrid.
Re: [2005] ASP.NET and Excel
Might be faster if you read from the Excel file (as a data source) into a dataset, then loop through the dataset instead.
Re: [2005] ASP.NET and Excel
Do you know of any resources I can look at to do what you suggested?