I have a singleton class that I'm calling DataManager and I want to use a thread to run a query every couple of minutes so that the user always has access to data that's fairly new without having to wait for the query to execute... problem is that I can't get the query to work.
Here's what I have...
private void UserThreadProc()
string ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\test.mdb;PWD=password";
string SelectText = "SELECT * FROM Users";
OleDbConnection conn = new OleDbConnection(ConnStr);
OleDbDataAdapter ssDA = new OleDbDataAdapter(SelectText, conn);
OleDbCommandBuilder cb = new OleDbCommandBuilder(ssDA);
ssDA.SelectCommand = new OleDbCommand(SelectText,conn);
I get "Could not find installable ISAM" error on line "ssDA.Fill(dsUsers)".
All the above code runs inside a thread (called "UserThread") that I want to continuously update the dataset dsUsers. dsUsers is declared inside my DataManager class as: public static DataSet dsUsers = new DataSet();. I also want to run another thread at the same time(Called "ReportThread") to do similar work on different data. The dataset that's updated by each thread will be used by a winform that may or may not be visible. I only need to read data, no updating is required.
1) I'm confused about the roles of different data components (DataSets, DataSources. Connections, Adapters, CommandBuilder, Commands, etc.).
2) I don't know if I should have seperate data connections for each of my threads or share one between them
3) I would like to know how to trap any errors that come out of this connection/query
As always, source code and any help you can give this newbie is appreciated. :)