Results 1 to 6 of 6

Thread: [2005] ASP.NET and Excel

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2006
    Location
    Between Try & Catch
    Posts
    249

    [2005] ASP.NET and Excel

    Hi all,

    I "inherited" an ASP.NET page that reads in an excel sheet. However, I want to know the most effecient way to check for duplicate rows.

    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. I need to handle about 10,000 rows at once. Therefore, I am very concerned about timeout issues.

    Is this the right approach? And if so, what resource can I look at to get started on it. If it's not the right approach, can someone give me an idea of what would be best?

    Thanks
    If my post helped you, please rate it!

    Languages: VB/ASP.NET 2005, C# 2008,VB6
    Databases: Oracle (knowledge not currently in use), DB2

    FROM Customers
    WHERE We_Know_What_We_Want <> DB.Null
    SELECT *
    0 rows returned

  2. #2
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    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.
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Dec 2006
    Location
    Between Try & Catch
    Posts
    249

    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.
    If my post helped you, please rate it!

    Languages: VB/ASP.NET 2005, C# 2008,VB6
    Databases: Oracle (knowledge not currently in use), DB2

    FROM Customers
    WHERE We_Know_What_We_Want <> DB.Null
    SELECT *
    0 rows returned

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Dec 2006
    Location
    Between Try & Catch
    Posts
    249

    Re: [2005] ASP.NET and Excel

    Do you know of any resources I can look at to do what you suggested?
    If my post helped you, please rate it!

    Languages: VB/ASP.NET 2005, C# 2008,VB6
    Databases: Oracle (knowledge not currently in use), DB2

    FROM Customers
    WHERE We_Know_What_We_Want <> DB.Null
    SELECT *
    0 rows returned

  6. #6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width