c# - threading problem (reading and writing to one excel file) -


i have application, something. generaly main task analise , drawing charts after getting data excel file. application can @ same time max. 10 analise , each of them execute in separate thread in separate tabpage control. great moment when appearing 3 problems.

  1. i can't reading data 1 excel file few analises. if i'm using 1 file 1 analise , want use same file it's not possible beacuse there massage file acctually using process. read data excel file i'm using oledbconnection schema. how solve problem.

  2. i have same problem write data 1 file. how force application write same message different threads 1 file.

  3. if want close application (when 1 of analise working) there show me message communication: "interruption lasted thread (or that)". don't know why. support

please me solve problems beacuse i'm trying solve sice monday , there no effect :(

possible example

string  fullexcelfilepath = "c:\excelfile.xls";   excel.application xlapp = new excel.application()  excel.workbook xlworkbook1 = xlapp.workbooks.add(fullexcelfilepath); excel.workbook xlworkbook2 = xlapp.workbooks.add(fullexcelfilepath);  //then in first threadcall foreach(excel.worksheet in xlworkbook1.sheets) { //get want }   //then in 2nd threadcal foreach(excel.worksheet in xlworkbook2.sheets) { //get want } 

other option is:

you make copy of xls other thread, ,

use copy of xls file in other thread.

file.copy(strfilename, strdestination); 

then afterwards delete it

file.delete(strfilenamesecondversion) 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -