c# - OleDbConnection close method taking long execution time -
constr = string.format(constr, filepath, ishdr); oledbconnection connexcel = new oledbconnection(constr); oledbcommand cmdexcel = new oledbcommand(); oledbdataadapter oda = new oledbdataadapter(); datatable dt = new datatable(); cmdexcel.connection = connexcel; //get name of first sheet connexcel.open(); datatable dtexcelschema; dtexcelschema = connexcel.getoledbschematable(oledbschemaguid.tables, null); string sheetname = dtexcelschema.rows[0]["table_name"].tostring(); connexcel.close();
i using above code read excel. stuck @ connexcel.close(); few seconds , move next statement. causing late processing on page. suggestions??
updating question give more details.
test case:- uploaded xls file took normal time. uploaded xlsx file halt @ connexcel.close() 25sec. uploaded xls file , halt xls also.
i have used following connection strings
for xls :- connectionstring="provider=microsoft.jet.oledb.4.0;data source={0}; extended properties='excel 8.0;hdr={1}'"
for xlsx :- connectionstring="provider=microsoft.ace.oledb.12.0;data source={0}; extended properties='excel 8.0;hdr={1}'"
Comments
Post a Comment