473,883 Members | 2,197 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error - System.Data.Ole Db.OleDbExcepti on: Could not use ''; file already in use. - please help

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

OleDbConnection oleConn = new
OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .4.0;Data
Source=C:\\Prog ram Files\\Microsof t Visual Studio .NET 2003\\Crystal
Reports\\Sample s\\Database\\xt reme.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.Ole Db.OleDbExcepti on: 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********** *************** **********

Jan 12 '06 #1
6 15427
Apparently the Access database is still open and locked for exclusive
use by something.

Are you accessing it from your app a second time (during the same run)
here? If so then make sure you are explictly closing the connection
from the first time.

Jan 12 '06 #2
I think i am doing it right. But still i am not sure though. Here is
the code i am using...

oRpt = new CustomerSales ();
/* Use ADO.NET object model to set up connection information */
OleDbConnection oleConn = new
OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .4.0;Data
Source=C:\\Prog ram Files\\Microsof t Visual Studio .NET 2003\\Crystal
Reports\\Sample s\\Database\\xt reme.mdb");
OleDbDataAdapte r oleAdapter = new OleDbDataAdapte r("SELECT * FROM
Customer", oleConn);
Dataset1 dataSet = new Dataset1();
/* Connect to, fetch data and disconnect from database */
oleAdapter.Fill (dataSet, "Customer") ;

/* Use Report Engine object model to pass populated dataset
to report */
oRpt.SetDataSou rce (dataSet);
/* bind report object with data to the Web Forms Viewer */
CrystalReportVi ewer1.ReportSou rce = oRpt;

Jan 12 '06 #3
put...

oleConn.Close() ;

....after the oleAdapter.Fill (dataSet, "Customer") ; line. I think you
need to explicitly close the connection to the database each time,
unless you modify the command behavior to do it automatically.

Jan 12 '06 #4
HI joey,
I thought i already replied to it. I am sorry about that. Yes it did
work for me and my bad i never closed the connection object.
thanks for the help
-L

Jan 13 '06 #5
PS: make sure your ASP account can create files in the same folder you MDB
file is.
Access driver creates ldb file which has locking information. Without it
your database will be opened in single user mode

George.
"Learner" <pr****@gmail.c om> wrote in message
news:11******** *************@g 44g2000cwa.goog legroups.com...
HI joey,
I thought i already replied to it. I am sorry about that. Yes it did
work for me and my bad i never closed the connection object.
thanks for the help
-L

Jan 13 '06 #6
I think it is not a real OleDbException. It is a matter of privilege.
You need to give the ASP account privilege to the folder at which the
xtreme.mdb file resides or move the file into the solution folder.

"Learner" wrote:
Hi there,
I am trying to access the access database sitting at

OleDbConnection oleConn = new
OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .4.0;Data
Source=C:\\Prog ram Files\\Microsof t Visual Studio .NET 2003\\Crystal
Reports\\Sample s\\Database\\xt reme.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.Ole Db.OleDbExcepti on: 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********** *************** **********

Feb 16 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1943
by: Mark | last post by:
Not sure this is the right place for this questions, but here goes: I get an error message when deleting an table from a Access database. The code is as follows and the error message is after it. ***************** Start Code ******************** <%@ import Namespace="System.Data" %> <%@ import Namespace="System.Data.Oledb" %>
4
2955
by: Mark | last post by:
Not sure this is the right place for this questions, but here goes: I get an error message when deleting an table from a Access database. The code is as follows and the error message is after it. ***************** Start Code ******************** <%@ import Namespace="System.Data" %> <%@ import Namespace="System.Data.Oledb" %>
3
1928
by: GotdotNet | last post by:
I get this error once in a while and I normally could fix it by restarting IIS. However, I would like to find out what causes this. Can anyone help? -----------------------------error screen----------------------------------- System.Data.OleDb.OleDbException: Unspecified error at System.Data.OleDb.OleDbDataReader.ProcessResults(Int32 hr) at System.Data.OleDb.OleDbDataReader.GetRowHandles()
1
1532
by: Mark | last post by:
Not sure this is the right place for this questions, but here goes: I get an error message when deleting an table from a Access database. The code is as follows and the error message is after it. ***************** Start Code ******************** <%@ import Namespace="System.Data" %> <%@ import Namespace="System.Data.Oledb" %>
9
3744
by: Nathan Sokalski | last post by:
I am recieving an error about not being able to use a file because it is already in use. Based on the error, I think it is referring to my DB, but I don't know how to avoid the error or why it is happening. Here is the error: Server Error in '/LVBEP' Application. -------------------------------------------------------------------------------- Could not use ''; file already in use. Description: An unhandled exception occurred during the...
7
22885
by: Jim McGivney | last post by:
ASPX page from VS.net-C# on host's computer using oleDataAdaptor to connect to Microsoft Access database. The page loads, but when connection to the database is attempted to fill a datagrid the following error is generated. Any help would be appreciated. Thanks, Jim Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information
5
9668
by: petro | last post by:
Hello all, My asp.net web application works on my machine but I get the following error on our test web server, There is only one oracle home on the test server. Does anyone know how to resolve this error? Oracle error occurred, but error message could not be retrieved from Oracle. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the...
6
2024
by: Ben | last post by:
I am trying to migrate my vb6.0 over to vb.net. Here is the error that that I am stuck with: Public myDB As DAO.Database ..... path = System.IO.Path.GetFullPath("..") myDB = WS.OpenDatabase(path & "\access.MDB", False, True) 'after I've created my workspace where WS is my workspace, I opend it up and vb.net recognized it. DeckUsers = dbCycDeck.OpenRecordset("USERS")
9
3456
by: dennist685 | last post by:
I created a web project named 'Access' in C:\Inetpub\wwwroot\Access and dropped an .mdb there. I dragged a DetailView to the form, configured it to show two fields of a table, and got AccessDataSource1. The test query worked. The .mdb was not open in Access, nor was it being used anywhere else. Yet when I pressed Cntl+F5 I got the following error:
0
9798
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11160
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10766
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10863
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9588
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7978
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5807
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4622
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3241
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.