473,402 Members | 2,064 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,402 software developers and data experts.

Opening Access file within a system service

Im trying to create a system service that will read some records within an
access file. From these values I will then be able to see if other software
in the system is up to date and install the new versions if they are not.
The problem im running into is that I can't get a connection to the file.

I keep on getting the error "The Microsoft Jet database engine cannot open
the file 'c:\DatabasesInfo.mdb'. It is already opened exclusively by another
user, or you need permission to view its data."

Now I know that the file is not opened up by anyone else so that must mean
that I don't have permission to use it.
Unfortunately I have no idea how I'm supose to give myself permission to use
it. Does anyone know how I can do that or if it's not that then what is it
that i'm doing wrong?

Here is the code that I use to open it.

Private Function ConnectionString() As String

Dim cnx As String = "Provider=Microsoft.Jet.OLEDB.4.0;Password=;Us er
ID=Admin;Data Source={0};Mode=ReadWrite|Share Deny None;;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"

Dim path As String = "c:\DatabasesInfo.mdb"

Return String.Format(cnx, path)

End Function

Private Function KitsAndTraysVersion() As String

EventLog1.WriteEntry("Starting Database Connection",
EventLogEntryType.Information)

Dim connection As New System.Data.OleDb.OleDbConnection(ConnectionString )

Dim output As String

Try

'Open Database Connection

connection.Open()

EventLog1.WriteEntry("Finished Database Connection",
EventLogEntryType.Information)

Dim command As New System.Data.OleDb.OleDbCommand(String.Empty, connection)

Dim reader As System.Data.OleDb.OleDbDataReader

command.CommandText = String.Format("select Version from Databases")

reader = command.ExecuteReader(CommandBehavior.Default)

While reader.Read

EventLog1.WriteEntry(reader("Version"), EventLogEntryType.Information)

End While

reader.Close()

Catch ex As Exception

EventLog1.WriteEntry(ex.Message, EventLogEntryType.Error)

Finally

'Close Database Connection

connection.Close()

End Try

Return output

End Function
Nov 20 '05 #1
0 1117

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

Similar topics

0
by: gmesmer | last post by:
Hello I have created an assembly to print a pdf document and I wrote some unit tests and everything works from within nuint and cruisecontrol.net. ( I am using C#) Next I have to put together a...
2
by: John | last post by:
Hi My app is in vb.net but the backend db is access. I am posting my question here as there is more access expertise here than in vb.net group. Here is the problem; I am opening a connection...
3
by: Mike Wilson | last post by:
Is there a way to open an OLE DB database from within Access? I would like to use the Access GUI with its table and query explorer to examine a database only available through an OLEDB provider...
0
by: ASP.Confused | last post by:
The old message looked a little stale, so I am re-posting it here. Anybody have any ideas of what I could do?!? The previous responses to this question are below. If you want to look at the...
4
by: Bruce | last post by:
I am developing an ASP.NET web service application. It works fine on my WinXP Prof development machine. But when I send it to a Windows Server 2003 system I get the following error (attached...
17
by: Mell via AccessMonster.com | last post by:
Is there a way to find out where an application was created from? i.e. - work or home i.e. - if application sits on a (work) server/network, the IT people know the application is sitting...
9
by: JT | last post by:
Here is the overall structure I will be referring to: End-program ProvideWorkFlow.dll Forms and methods that properly manipulate calls to methods in AccessUtils AccessUtils (a web service)...
4
by: carson | last post by:
I have written two windows services: - service A does some crunching of local data files and uploads them to a central processing computer via http. - service B monitors a manifest file on a...
2
by: | last post by:
Hi all, I have an asp.net 2.0 website that accesses a locally hosted web service. This works fine on servers that are connected to our network. However, I am having a problem with a laptop...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
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
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...
0
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,...

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.