This code block takes too much time to execute C#

68 Views Asked by At
            OleDbConnection connection;
            OleDbCommand command;
   

            string commandText = "SELECT pali,sinhala FROM [Sheet3$]";
            string oledbConnectString = "Provider=Microsoft.ACE.OLEDB.12.0;" +
            @"Data Source=Book2.xlsx;" +
            "Extended Properties=\"Excel 12.0;HDR=YES\";";
            connection = new OleDbConnection(oledbConnectString);
            command = new OleDbCommand(commandText, connection);
            OleDbDataAdapter da = new OleDbDataAdapter(command);
            connection.Close();
            DataTable dt = new DataTable();
            da.Fill(dt);
            dataGridView1.DataSource = dt;

Excel sheet have 20 000 rows(UTF8 unicode). even my Lap 8gb ram i3 it takes like 8secs to load. Is their any way to store these data? I want to create a Dictionary(not csharp dictionary).

0

There are 0 best solutions below