ADO.NET in C# - Please help!!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have written an application in C# that runs as a service to connect to an Access database that resides on a mapped drive. I have Read, Write, Create and Modify permission on the folder

I am using the System.Data.OleDb namespace with the following connection string

In an xml file I have an element with the string Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Database Password=dax12;Data Source="F:\da.mdb";Password=;Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk Transactions=1;Provider="Microsoft.Jet.OLEDB.4.0";Jet OLEDB:System database=;Jet OLEDB:SFP=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:New Database Password=;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Encrypt Database=False

If I try to connect to the database through the IDE I am able to do it. If I run the service, I get the following error: " 'F:\da.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.

I have tried to run the service under another account and that doesn’t work. The account is a member of Administrators group. I've also tried changing the permission set to FullTrust in LocalIntranet_Zone Code Group under Machine using the .NET 1.1 Configuration Console

What else am I missing? Could anyone out there help me please??

Thanks very much in advance
 
Hi Miranda, my first guess would be to check that the mapped drive is setup
for all users. If the network path is setup for just you, and not the
account that the service is run under, the application would work in the IDE
(since it is executed under your account), but not when you run as the
service (because the mapped drive does not exist for the account the service
is run under).

I may be *WAY* off here, but this would be the first thing I would check.
Good luck!

--
Jason Olson
http://geekswithblogs.net/jolson

Miranda said:
I have written an application in C# that runs as a service to connect to
an Access database that resides on a mapped drive. I have Read, Write,
Create and Modify permission on the folder.
I am using the System.Data.OleDb namespace with the following connection string.

In an xml file I have an element with the string Jet OLEDB:Global Partial
Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=1;Jet
OLEDB:Database Password=dax12;Data Source="F:\da.mdb";Password=;Jet
OLEDB:Engine Type=5;Jet OLEDB:Global Bulk
Transactions=1;Provider="Microsoft.Jet.OLEDB.4.0";Jet OLEDB:System
database=;Jet OLEDB:SFP=False;Extended Properties=;Mode=Share Deny None;Jet
OLEDB:New Database Password=;Jet OLEDB:Create System Database=False;Jet
OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica
Repair=False;User ID=Admin;Jet OLEDB:Encrypt Database=False
If I try to connect to the database through the IDE I am able to do it.
If I run the service, I get the following error: " 'F:\da.mdb' is not a
valid path. Make sure that the path name is spelled correctly and that you
are connected to the server on which the file resides."
I have tried to run the service under another account and that doesn't
work. The account is a member of Administrators group. I've also tried
changing the permission set to FullTrust in LocalIntranet_Zone Code Group
under Machine using the .NET 1.1 Configuration Console.
 
Hi Miranda,

Why not first bring your connection string as simple needed down for for a
connection and see if it works?
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\MDA.mdb;"

Just a thought,

Cor
 
Back
Top