473,386 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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!
Jul 19 '05 #1
6 6715
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!

Jul 19 '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!

Jul 19 '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!
:
:
Jul 19 '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!


Jul 19 '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!
>
>



Jul 19 '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!
: > :
: > :
: >
: >
:
:

Jul 19 '05 #7

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

Similar topics

22
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
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
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
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
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
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
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
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
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...

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.