Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 07:27 AM
Mohammed AlQuraishi
Guest
 
Posts: n/a
Default 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!


  #2  
Old July 19th, 2005, 07:27 AM
Mohammed AlQuraishi
Guest
 
Posts: n/a
Default Re: Connect to Access db from VC#

P.S. I tried setting impersonation to true and now I'm getting an
"unspecified error"... It still doesn't work :(


"Mohammed AlQuraishi" <simplemo@hotmail.com> wrote in message
news:eNUcHiJXDHA.2648@TK2MSFTNGP09.phx.gbl...[color=blue]
> Hi all,
>
> I'm trying to connect to an MS Access database using ADO.NET and C#, but[/color]
I'm[color=blue]
> getting the dreaded "Microsoft Jet database engine cannot open the file[/color]
'x'.[color=blue]
> It is already opened exclusively by another user, or you need permission[/color]
to[color=blue]
> 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!
>
>[/color]


  #3  
Old July 19th, 2005, 07:27 AM
Sreejumon[MVP]
Guest
 
Posts: n/a
Default Re: Connect to Access db from VC#

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" <simplemo@hotmail.com> wrote in message
news:eNUcHiJXDHA.2648@TK2MSFTNGP09.phx.gbl...[color=blue]
> Hi all,
>
> I'm trying to connect to an MS Access database using ADO.NET and C#, but[/color]
I'm[color=blue]
> getting the dreaded "Microsoft Jet database engine cannot open the file[/color]
'x'.[color=blue]
> It is already opened exclusively by another user, or you need permission[/color]
to[color=blue]
> 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!
>
>[/color]


  #4  
Old July 19th, 2005, 07:27 AM
Ken Schaefer
Guest
 
Posts: n/a
Default Re: Connect to Access db from VC#

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" <simplemo@hotmail.com> wrote in message
news:eNUcHiJXDHA.2648@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!
:
:


  #5  
Old July 19th, 2005, 07:27 AM
Mohammed AlQuraishi
Guest
 
Posts: n/a
Default Re: Connect to Access db from VC#

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]" <sreeju_uss@hotmail.com> wrote in message
news:%23cofgOKXDHA.1888@TK2MSFTNGP10.phx.gbl...[color=blue]
> 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" <simplemo@hotmail.com> wrote in message
> news:eNUcHiJXDHA.2648@TK2MSFTNGP09.phx.gbl...[color=green]
> > Hi all,
> >
> > I'm trying to connect to an MS Access database using ADO.NET and C#, but[/color]
> I'm[color=green]
> > getting the dreaded "Microsoft Jet database engine cannot open the file[/color]
> 'x'.[color=green]
> > It is already opened exclusively by another user, or you need permission[/color]
> to[color=green]
> > 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!
> >
> >[/color]
>
>[/color]


  #6  
Old July 19th, 2005, 07:27 AM
Mohammed AlQuraishi
Guest
 
Posts: n/a
Default Re: Connect to Access db from VC#

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]" <sreeju_uss@hotmail.com> wrote in message
news:OVtDSqKXDHA.608@TK2MSFTNGP12.phx.gbl...[color=blue]
> Could you please send your code snippet ?
>
> --
> Let me know if you need further help
>
> Regards
> Sreejumon[MVP]
> www.mstechzone.com
>
> "Mohammed AlQuraishi" <simplemo@hotmail.com> wrote in message
> news:#mkGemKXDHA.1872@TK2MSFTNGP12.phx.gbl...[color=green]
> > 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.[/color]
> However,[color=green]
> > I am getting a new error now, namely "Unspecific error has occurred"...
> >
> > Any ideas? Thank you very much!
> >
> > "Sreejumon[MVP]" <sreeju_uss@hotmail.com> wrote in message
> > news:%23cofgOKXDHA.1888@TK2MSFTNGP10.phx.gbl...[color=darkred]
> > > 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" <simplemo@hotmail.com> wrote in message
> > > news:eNUcHiJXDHA.2648@TK2MSFTNGP09.phx.gbl...
> > > > Hi all,
> > > >
> > > > I'm trying to connect to an MS Access database using ADO.NET and C#,[/color][/color]
> but[color=green][color=darkred]
> > > I'm
> > > > getting the dreaded "Microsoft Jet database engine cannot open the[/color][/color]
> file[color=green][color=darkred]
> > > 'x'.
> > > > It is already opened exclusively by another user, or you need[/color][/color]
> permission[color=green][color=darkred]
> > > to
> > > > view its data."
> > > >
> > > > Any ideas as to why? I set up a connection using Jet 4.0 and I'm[/color][/color][/color]
able[color=blue]
> to[color=green][color=darkred]
> > > > open the database from within VC#.
> > > >
> > > > Thanks for any help!
> > > >
> > > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


  #7  
Old July 19th, 2005, 07:28 AM
Mohammed AlQuraishi
Guest
 
Posts: n/a
Default Re: Connect to Access db from VC#

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" <kenREMOVE@THISadOpenStatic.com> wrote in message
news:eW3d$gLXDHA.1580@tk2msftngp13.phx.gbl...[color=blue]
> 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"[/color]
option[color=blue]
> now where you can set NTFS permissions (assuming that your drive is
> formatting NTFS, not FAT32).
>
> Cheers
> Ken
>
>
> "Mohammed AlQuraishi" <simplemo@hotmail.com> wrote in message
> news:OI4wemKXDHA.1872@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[/color]
change[color=blue]
> : it? (XP hides a lot of the stuff that Win2k exposes)
> :
> : Thanks for your help!
> :
> : "Ken Schaefer" <kenREMOVE@THISadOpenStatic.com> wrote in message
> : news:%23tVOpYKXDHA.2256@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" <simplemo@hotmail.com> wrote in message
> : > news:eNUcHiJXDHA.2648@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[/color]
able[color=blue]
> to
> : > : open the database from within VC#.
> : > :
> : > : Thanks for any help!
> : > :
> : > :
> : >
> : >
> :
> :
>
>[/color]


 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles