Error - Could not use ''; file already in use.- please help!

Error - Could not use ''; file already in use.- please help!

Post by Learne » Sat, 14 Jan 2006 01:24:02



Hi there,
  I am trying to access the access database sitting at

OleDbConnection oleConn = new
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Crystal
Reports\\Samples\\Database\\xtreme.mdb");

and create a crystal report using c#. I have done every thing but for
some reaspon when i try running my webform its throing the below error.
Is there any thing i am missing or need to do some kind of security
settings?

Please help .
thanks in advance
-L

*********************************Error**************************************************
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Could not use '';
file already in use.

Source Error:

Line 39: Dataset1 dataSet = new Dataset1();
Line 40: /* Connect to, fetch data and disconnect from database */
Line 41: oleAdapter.Fill(dataSet, "Customer");
Line 42: /* Use Report Engine object model to pass populated dataset
Line 43: to report */

*************************************End of the
error***********************************

 
 
 

Error - Could not use ''; file already in use.- please help!

Post by gopi » Sun, 22 Jan 2006 00:16:41


Hi learner

Use Try and Catch block as shown below

Try
 Dataset1 dataSet = new Dataset1();
 oleAdapter.Fill(dataSet, "Customer");

After the code line of closing connection for eg conn.close

use

Catch

   Put here the messagebox for oledbexcepiton

 
 
 

Error - Could not use ''; file already in use.- please help!

Post by Anan » Sun, 22 Jan 2006 01:45:23


Hi gopi,
        When performing DB operation within a try catch block, it is always
recommended to close connection within the finally block. This is no way
related to the problem in fact I have not read the problem, since u
specified to close connection and then use catch I thought let me comment on
it.

Anand.

-----Original Message-----


Sent: Friday, January 20, 2006 8:47 PM
To: DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web
Services,.NET Remoting
Subject: [DotNetDevelopment] Re: Error - Could not use ''; file already in
use.- please help!

Hi learner

Use Try and Catch block as shown below

Try
 Dataset1 dataSet = new Dataset1();
 oleAdapter.Fill(dataSet, "Customer");

After the code line of closing connection for eg conn.close

use

Catch

   Put here the messagebox for oledbexcepiton