473,586 Members | 2,718 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 15377
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
1917
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
2932
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
1916
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)...
1
1513
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
3719
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. --------------------------------------------------------------------------------...
7
22840
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...
5
9637
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...
6
2016
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 =...
9
3442
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...
0
7911
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7839
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...
0
8338
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...
0
8215
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6610
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...
0
3836
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...
1
2345
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
1
1448
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1179
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...

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.