I have table with several thousand rows, but even if I try to read 1000 rows (and 10 columns) it takes about 10 second to get result. I think it's too slow, but I can't find any problem.
Code for reading data:
string connectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties="Excel 8.0;HDR=Yes;"", _excelFilename);
using (OleDbConnection c = new OleDbConnection(connectionString)) {
c.Open();
OleDbCommand cmd = new OleDbCommand("SELECT * FROM [Trend_Data$A1:J1000]", c);
OleDbDataReader dbReader = dbCommand.ExecuteReader();
while (dbReader.Read()) {
object[] values = new object[10];
dbReader.GetValues(values);
//save values into internal structure - fast
...
}
Stepping through the code I found that calling ExecuteReader function takes so long.
Do you have any ideas, how to speed up code?