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

Service app and lurking Access .ldb file

I've created a Windows Service application that creates a
table in an Access database from the information in a text
file, everytime a new textfile shows up in a certain
directory. It functions but I notice that a .ldb file
(Microsoft Access Record-Locking Information) file remains
after the process and it only goes away when the service
is stopped. Why does this happen if I'm closing my
recordset and closing my connection? Here's the code:

Public Sub FileSystemWatcher1_Changed(ByVal sender As _
System.Object, ByVal e As _
System.IO.FileSystemEventArgs) Handles IRWatcher.Created
Dim stTrunc As String
Dim stInPath As String
Dim stOutPath As String
Dim fs
Dim fIn
Dim CnxnEDI As ADODB.Connection
Dim strCnxn As String
Dim strSQL As String
Dim rstEDI As ADODB.Recordset
Dim strLine As String
Dim strField1 As String
Dim strField2 As String

stTrunc = Microsoft.VisualBasic.Left(e.Name, _
(Len(e.Name) - 4))
stInPath = e.FullPath
fs = CreateObject("Scripting.FileSystemObject")
fIn = fs.OpenTextFile(stInPath)

CnxnEDI = New ADODB.Connection
strCnxn = "Provider=Microsoft.JET.OLEDB.4.0; _
Data Source=C:\test_be.mdb"
CnxnEDI.Open(strCnxn)

strSQL = "CREATE TABLE " & stTrunc & " _
(Field1 varchar(8), Field2 text)"
CnxnEDI.Execute(strSQL)

rstEDI = New ADODB.Recordset
strSQL = stTrunc
rstEDI.Open(strSQL, strCnxn, adOpenDynamic, _
adLockPessimistic)

Do While fIn.AtEndOfStream <> True
strLine = fIn.readline
strField1 = Mid(strLine, 1, 8)
strField2 = Trim(Mid(strLine, 10))
With rstEDI
If rstEDI.RecordCount > 0 Then
rstEDI.MoveLast()
rstEDI.AddNew()
rstEDI("Field1").Value = strField1
rstEDI("Field2").Value = strField2
rstEDI.Update()
Else
rstEDI.AddNew()
rstEDI("Field1").Value = strField1
rstEDI("Field2").Value = strField2
rstEDI.Update()
End If
End With
Loop

fIn.Close()
fs = Nothing

rstEDI.Close()
rstEDI = Nothing

CnxnEDI.Close()
CnxnEDI = Nothing
End Sub
Jul 19 '05 #1
1 2412
On Thu, 4 Sep 2003 09:07:46 -0700, "Zachariah" <za*********@yahoo.com> wrote:

¤ I've created a Windows Service application that creates a
¤ table in an Access database from the information in a text
¤ file, everytime a new textfile shows up in a certain
¤ directory. It functions but I notice that a .ldb file
¤ (Microsoft Access Record-Locking Information) file remains
¤ after the process and it only goes away when the service
¤ is stopped. Why does this happen if I'm closing my
¤ recordset and closing my connection? Here's the code:

I don't see any issues with the code. If the code runs as a standalone executable do you experience
the same problem?

Since you're working with ADO COM objects via interop it's also possible the objects are not being
released.

I don't think it is a delete permissions issue since the .LDB file is removed after the process is
stopped.
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Jul 19 '05 #2

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

Similar topics

6
by: Rob | last post by:
Hi, I am working on a project that requires a Windows Service which performs the following file transfer functions. 1. It monitors a specific local directory on a Windows 2003 Server. 2. When...
9
by: SP | last post by:
Hi All, I wrote a windows service which is supposed to stop after specified amount of time. I am calling OnStop() after specified time. OnStop() methods executed but I dont see the service...
3
by: Shailesh Humbad | last post by:
I figured out what was causing the "Access is Denied" error when calling functions from referenced DLLs in my service. I've tried to be very detailed, so bear with me. It turns out that...
2
by: Dan | last post by:
Hi there, I've got a WebService application that works fine under Windows 2000 with Framework 1.0 Installing it on Windows 2003 results in SoapExceptions being thrown when any of the methods...
2
by: Zachariah | last post by:
I've created a Windows Service application that creates a table in an Access database from the information in a text file, everytime a new textfile shows up in a certain directory. It functions...
1
by: Rob C | last post by:
I want to develop some data access web services in C# that can be accessed from both an ASP.NET web application as well as a VC++ desktop application. i have used web services in the past from VC++...
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...
22
by: robertgregson | last post by:
Using C#, .NET3.5, Visual Studio 2008 and WCF on Windows VISTA SP1, I have written a service, service host (as a C# console application) and a client. The service uses...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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,...
0
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...

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.