473,508 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Connect to Access db from VC#

Hi all,

I'm trying to connect to an MS Access database using ADO.NET and C#, but I'm
getting the dreaded "Microsoft Jet database engine cannot open the file 'x'.
It is already opened exclusively by another user, or you need permission to
view its data."

Any ideas as to why? I set up a connection using Jet 4.0 and I'm able to
open the database from within VC#.

Thanks for any help!
Nov 17 '05 #1
6 1012
P.S. I tried setting impersonation to true and now I'm getting an
"unspecified error"... It still doesn't work :(
"Mohammed AlQuraishi" <si******@hotmail.com> wrote in message
news:eN**************@TK2MSFTNGP09.phx.gbl...
Hi all,

I'm trying to connect to an MS Access database using ADO.NET and C#, but I'm getting the dreaded "Microsoft Jet database engine cannot open the file 'x'. It is already opened exclusively by another user, or you need permission to view its data."

Any ideas as to why? I set up a connection using Jet 4.0 and I'm able to
open the database from within VC#.

Thanks for any help!

Nov 17 '05 #2
Hi,

I think the problem is the ASPNET user permision.
Please refer the following link.

http://support.microsoft.com/default...;EN-US;Q316675

--
Let me know if you need further help

Regards
Sreejumon[MVP]
www.mstechzone.com

"Mohammed AlQuraishi" <si******@hotmail.com> wrote in message
news:eN**************@TK2MSFTNGP09.phx.gbl...
Hi all,

I'm trying to connect to an MS Access database using ADO.NET and C#, but I'm getting the dreaded "Microsoft Jet database engine cannot open the file 'x'. It is already opened exclusively by another user, or you need permission to view its data."

Any ideas as to why? I set up a connection using Jet 4.0 and I'm able to
open the database from within VC#.

Thanks for any help!

Nov 17 '05 #3
Sounds like a permissions problem.

If the .mdb file is located on the same machine as the webserver, give the
ASPNet user account Read/Write NTFS permissions to the folder that the .mdb
file is in, and the Creator/Owner user Full Control.

Cheers
Ken

"Mohammed AlQuraishi" <si******@hotmail.com> wrote in message
news:eN**************@TK2MSFTNGP09.phx.gbl...
: Hi all,
:
: I'm trying to connect to an MS Access database using ADO.NET and C#, but
I'm
: getting the dreaded "Microsoft Jet database engine cannot open the file
'x'.
: It is already opened exclusively by another user, or you need permission
to
: view its data."
:
: Any ideas as to why? I set up a connection using Jet 4.0 and I'm able to
: open the database from within VC#.
:
: Thanks for any help!
:
:
Nov 17 '05 #4
Well I did set impersonation to true, which, if what I gathered from the
document is correct, ought to be sufficient to resolve the problem. However,
I am getting a new error now, namely "Unspecific error has occurred"...

Any ideas? Thank you very much!

"Sreejumon[MVP]" <sr********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi,

I think the problem is the ASPNET user permision.
Please refer the following link.

http://support.microsoft.com/default...;EN-US;Q316675

--
Let me know if you need further help

Regards
Sreejumon[MVP]
www.mstechzone.com

"Mohammed AlQuraishi" <si******@hotmail.com> wrote in message
news:eN**************@TK2MSFTNGP09.phx.gbl...
Hi all,

I'm trying to connect to an MS Access database using ADO.NET and C#, but

I'm
getting the dreaded "Microsoft Jet database engine cannot open the file

'x'.
It is already opened exclusively by another user, or you need permission

to
view its data."

Any ideas as to why? I set up a connection using Jet 4.0 and I'm able to
open the database from within VC#.

Thanks for any help!


Nov 17 '05 #5
Well I have an dbOleConnection object set at design time to:

Provider=Microsoft.Jet.OLEDB.4.0;Password="";User ID=Admin;Data
Source=C:\Inetpub\wwwroot\Flows\db1.mdb;Mode=ReadW rite|Share Deny
None;Extended Properties="";Jet OLEDB:System database="";Jet OLEDB:Registry
Path="";Jet OLEDB:Database Password="";Jet OLEDB:Engine Type=5;Jet
OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet
OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="";Jet
OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet
OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica
Repair=False;Jet OLEDB:SFP=False

And my dummy function simply tries to open the oleDbConnection object by
invoking the Open method. That's it.

This is the error I'm getting:
Server Error in '/Flows' Application.
----------------------------------------------------------------------------
----

Unspecified 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: Unspecified error

Source Error:

Line 62: private void Button1_Click(object sender, System.EventArgs e)
Line 63: {
Line 64: oleDbConnection1.Open();
Line 65: System.Data.OleDb.OleDbDataReader myReader =
oleDbCommand1.ExecuteReader();
Line 66: while (myReader.Read())

Source File: c:\inetpub\wwwroot\flows\webform1.aspx.cs Line: 64

Stack Trace:

[OleDbException (0x80004005): Unspecified error]
System.Data.OleDb.OleDbConnection.ProcessResults(I nt32 hr)
System.Data.OleDb.OleDbConnection.InitializeProvid er()
System.Data.OleDb.OleDbConnection.Open()
Flows.WebForm1.Button1_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\flows\webform1.aspx.cs:64
System.Web.UI.WebControls.Button.OnClick(EventArgs e)

System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePo
stBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()


Thanks again for any help!
"Sreejumon[MVP]" <sr********@hotmail.com> wrote in message
news:OV*************@TK2MSFTNGP12.phx.gbl...
Could you please send your code snippet ?

--
Let me know if you need further help

Regards
Sreejumon[MVP]
www.mstechzone.com

"Mohammed AlQuraishi" <si******@hotmail.com> wrote in message
news:#m**************@TK2MSFTNGP12.phx.gbl...
Well I did set impersonation to true, which, if what I gathered from the
document is correct, ought to be sufficient to resolve the problem. However,
I am getting a new error now, namely "Unspecific error has occurred"...

Any ideas? Thank you very much!

"Sreejumon[MVP]" <sr********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi,

I think the problem is the ASPNET user permision.
Please refer the following link.

http://support.microsoft.com/default...;EN-US;Q316675

--
Let me know if you need further help

Regards
Sreejumon[MVP]
www.mstechzone.com

"Mohammed AlQuraishi" <si******@hotmail.com> wrote in message
news:eN**************@TK2MSFTNGP09.phx.gbl...
> Hi all,
>
> I'm trying to connect to an MS Access database using ADO.NET and C#, but I'm
> getting the dreaded "Microsoft Jet database engine cannot open the file 'x'.
> It is already opened exclusively by another user, or you need permission to
> view its data."
>
> Any ideas as to why? I set up a connection using Jet 4.0 and I'm
able to > open the database from within VC#.
>
> Thanks for any help!
>
>



Nov 17 '05 #6
You've got to be kidding me! That's all I had to do!!!!

Why on earth do they make it so difficult? Such a simple task and it took me
a whole day! Wow thank you very much! Really appreciate the help!!!

Mohammed

"Ken Schaefer" <ke*******@THISadOpenStatic.com> wrote in message
news:eW**************@tk2msftngp13.phx.gbl...
You may need to disable "Simple File Sharing"

Open an Explorer Window, got Tools -> Folder Options -> Scroll down to the
button -> Uncheck "Use Simple File Sharing"

Then, when you right-click ona folder, you should have a "security" option now where you can set NTFS permissions (assuming that your drive is
formatting NTFS, not FAT32).

Cheers
Ken
"Mohammed AlQuraishi" <si******@hotmail.com> wrote in message
news:OI**************@TK2MSFTNGP12.phx.gbl...
: Yes it is in fact on the same machine, but I'm running XP Pro, so the
: permissions should already be taken care of, no? If not where do I change : it? (XP hides a lot of the stuff that Win2k exposes)
:
: Thanks for your help!
:
: "Ken Schaefer" <ke*******@THISadOpenStatic.com> wrote in message
: news:%2****************@TK2MSFTNGP10.phx.gbl...
: > Sounds like a permissions problem.
: >
: > If the .mdb file is located on the same machine as the webserver, give
the
: > ASPNet user account Read/Write NTFS permissions to the folder that the
: .mdb
: > file is in, and the Creator/Owner user Full Control.
: >
: > Cheers
: > Ken
: >
: > "Mohammed AlQuraishi" <si******@hotmail.com> wrote in message
: > news:eN**************@TK2MSFTNGP09.phx.gbl...
: > : Hi all,
: > :
: > : I'm trying to connect to an MS Access database using ADO.NET and C#,
but
: > I'm
: > : getting the dreaded "Microsoft Jet database engine cannot open the
file
: > 'x'.
: > : It is already opened exclusively by another user, or you need
permission
: > to
: > : view its data."
: > :
: > : Any ideas as to why? I set up a connection using Jet 4.0 and I'm able to
: > : open the database from within VC#.
: > :
: > : Thanks for any help!
: > :
: > :
: >
: >
:
:

Nov 17 '05 #7

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

Similar topics

22
3200
by: James Kupernik | last post by:
Hello everyone! I'm hoping someone can shed some light on my ever daunting mysql/php problem. I'm currently trying to get a new server up and running using apache/php/mysql. Everything runs...
0
3008
by: chris | last post by:
Hi, I try to connect to Access with php with te code below. The database and table are ok. <?php include('../adodb/adodb.inc.php'); $db =& ADONewConnection('access'); $dsn =...
5
4591
by: Kona | last post by:
Hello, Is it right to tell that DB2 Connect has the same function that Oracle Net ? If I have an ODBC application is it also right to tell that I have 2 possibilities on my client workstation to...
11
27210
by: Marcus | last post by:
Hello! I'm trying to write a VB.NET program that connects to a AS/400 Server. I've tried almost everything, but it will not connect. I've tried to set up a DSN using the Client Access...
5
5662
by: mayamorning123 | last post by:
A comparison among six VSS remote tools including SourceOffSite , SourceAnyWhere, VSS Connect, SourceXT, VSS Remoting, VSS.NET To view the full article, please visit...
1
2296
by: Dave | last post by:
I am trying to learn .NET with the standard edition of VC++.NET 2003 Standard edition. When I use the wizard in the toolbox to connect to a non-microsoft ODBC data source, I get the error message...
3
4043
by: Laurence | last post by:
Hi there, Does somebody know the efficent way to connect DB2/400? Through iSeries Access ODBC/OLEDB driver or DB2 Connect? Which will more fast and efficent? In addition, does DB2 Connect use...
2
3317
by: vikas.bhatia | last post by:
Is this still true? http://groups.google.com/group/comp.databases.ibm-db2/browse_thread/thread/58c6c36ce9006d50/778f98749d8e2983?lnk=st&q=DB2+Connect+product+license&rnum=6#778f98749d8e2983 would...
6
4582
by: Al G | last post by:
Can someone tell me what I need to get connected to our AS400? I am trying to write an app in VS2005(Data source, Gridview) that requires data from files on our AS400. I've downloaded DB2, and...
0
7115
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...
0
7377
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...
1
7036
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...
0
7489
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...
1
5047
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...
0
4705
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1547
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 ...
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.