Data Danger
Active member
- Joined
- Mar 25, 2004
- Messages
- 29
Hi All
I have just changed to VS2005 from VS2003 and now the following error happens it does not happen in the VS2003 .NET 1.1.
I have a process that produces a new database and it updates several tables. Im using OLEDB Connections and when the process is finished I close the connection. The connection is dimensioned in the declaration part of the form so that other processes can share the connection at a later stage.
In the VS2003 I can quite happly keep pressing the process button all day with no error.
In the VS2005 none of the code as changed, every now and then I get a error Could not use File file in use. At the start of the process I use, if c_Connection.State = ConnectionState.Closed then c_connection.Open, at the stage the error is fired. I,m on a standalone machine so nobody else can use the Database (Access 2000 Format). What I have had to do is put the c_Connection.Open in a Try Catch and if the error is fired then go back to the open connection line a try again. I have put in a retry counter so if it attemps it 10 times then report the error. So far it has always opened the file on the first retry.
I have tried using the ResetState, GC.Collect and Application.DoEvents but none seem to make any difference.
Sometimes I can keep running the process 50 to 60 times then the error is fired or just 2 times and the error is fired there seems no logic to when the error accurrs. If it happen all the time then at least I would no some other process is keeping it open.
Could somebody please tell me what it might be? Could it be the pooling? Do I need Pooling on a standalone package? Can I check to see what might be keeping the DB open? It is only my process that opens and closes the database no other part of the program uses it and to repeat, it does not happen in VS2003.
Regards - Paul
I have just changed to VS2005 from VS2003 and now the following error happens it does not happen in the VS2003 .NET 1.1.
I have a process that produces a new database and it updates several tables. Im using OLEDB Connections and when the process is finished I close the connection. The connection is dimensioned in the declaration part of the form so that other processes can share the connection at a later stage.
In the VS2003 I can quite happly keep pressing the process button all day with no error.
In the VS2005 none of the code as changed, every now and then I get a error Could not use File file in use. At the start of the process I use, if c_Connection.State = ConnectionState.Closed then c_connection.Open, at the stage the error is fired. I,m on a standalone machine so nobody else can use the Database (Access 2000 Format). What I have had to do is put the c_Connection.Open in a Try Catch and if the error is fired then go back to the open connection line a try again. I have put in a retry counter so if it attemps it 10 times then report the error. So far it has always opened the file on the first retry.
I have tried using the ResetState, GC.Collect and Application.DoEvents but none seem to make any difference.
Sometimes I can keep running the process 50 to 60 times then the error is fired or just 2 times and the error is fired there seems no logic to when the error accurrs. If it happen all the time then at least I would no some other process is keeping it open.
Could somebody please tell me what it might be? Could it be the pooling? Do I need Pooling on a standalone package? Can I check to see what might be keeping the DB open? It is only my process that opens and closes the database no other part of the program uses it and to repeat, it does not happen in VS2003.
Regards - Paul