Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In addition to one or two comments I've added so far.... =)</p> <p>As you've noticed in your 3rd edit, once a reader has been disposed, you are unable to fetch the data from it. </p> <p>The idea is that you create and open your connection. Fetch the data as early as possible when the connection is open, and then dispose any resources that were used once you have the data.</p> <p>In your case, you are opening and closing the connection within the readCSV function, then passing the closed reader back to "StartAsyncTask". What you could do perhaps, is slightly refactor... Instead of using the <a href="http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbdatareader%28v=VS.100%29.aspx" rel="nofollow">OleDbDataReader</a> you could use an <a href="http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbdataadapter.aspx" rel="nofollow">OleDbDataAdapter</a>. Using the adapter you can call the <a href="http://msdn.microsoft.com/en-us/library/zxkb3c3d.aspx" rel="nofollow">Fill method</a> to populate a dataset. </p> <p>Once a dataset has been populated, it is in memory. You can close the adapter, close the connection, dispose of both ('using' statements) and pass the dataset back to your StartAsync method?</p> <p>Comment on here if you need any examples of this.</p> <p>Good luck!</p> <p>EDIT:</p> <p>A quick note on the multithreading work you're doing...</p> <p>Regarding the IIS settings, if you are running your website on more than one process be aware that at some stage you will likely have 2 processes (or more) sat awaiting the file system watcher. When the FSW detects a change it will notify both of your processes; in an unpredictable order, but likely in quick succession, which in turn will cause two seperate threads to start reading the files. You <em>may</em> encounter issues at this stage when two threads request the Jet Provider to open the same file(s) at the same time. Ensure you have plenty of exception catching logic in here to help.</p> <p>You might even need to consider the use of <a href="http://msdn.microsoft.com/en-us/library/system.threading.mutex.aspx" rel="nofollow">mutexes</a> if this is the case for you, to allow one process at a time to process results, but I rarely like to encourage those.</p> <p>On the note of thread exceptions, take a look at <a href="http://flimflan.com/blog/SafelyRunningBackgroundThreadsInASPNET20.aspx" rel="nofollow">this article</a> which I believe still holds true in IIS7.5/.Net 4. Be very careful with your worker threads, exceptions can take down the website if not caught.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload