上传excel文件 [英] uploading the excel file

查看:89
本文介绍了上传excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个15列的表格.假设我在表中有10000条记录.
我想一一检查所有15列中表中的重复记录.

当我上载具有10000条记录的excel文件时,速度非常慢.

请帮助我了解速度.如何提高速度?

在本地计算机上速度非常好

但是在服务器上速度很慢.

I have a table with 15 column. Suppose I have 10000 records in the table.
I want to check the duplicate records in the table with all 15 column one by one .

When i am uploading the excel file with 10000 records the speed is vey slow.

please help me about the speed.how we can improve the speed?

the speed is very good at local computer

but the speed is slow on the server.

推荐答案

如果可能的话,将您正在使用的代码附加到代码中,将很容易进行处理.

同时获取Datatable中提取的excel行,以便您可以轻松地将rowfilter应用于重复.
If possible to attach a code what you are using it will really easy to go through the proceedings.

in the mean time get the excel rows extracted in Datatable so the u can easily apply rowfilter for duplication.


您应该已经在问题中发布了代码,无论如何都应应用这些

使用ASP.NET上传大文件:什么是最佳做法? [ ^ ]

在ASP.NET中上传文件 [
You should have posted your code in your question, Anyway apply these

Uploading large files with ASP.NET: what are the best practices?[^]

Uploading Files in ASP.NET[^]


使用以下代码从中读取数据优秀.
Use the code below to read the data from excel.
private OleDbConnection returnConnection(string fileName)
    {
        return new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileName + "; Jet OLEDB:Engine Type=5;Extended Properties=\"Excel 8.0;\"");
    }

    private DataTable loadSingleSheet(string fileName, string sheetName)
    {
        DataTable sheetData = new DataTable();
        using (OleDbConnection conn = this.returnConnection(fileName))
        {
           conn.Open();
           // retrieve the data using data adapter
           OleDbDataAdapter sheetAdapter = new OleDbDataAdapter("select * from [" + sheetName + "]", conn);
            sheetAdapter.Fill(sheetData);
        }
        return sheetData;
    }



然后将DataTable 保存到数据库.



Then save the DataTable to the database.


这篇关于上传excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆