473,405 Members | 2,141 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.

BackgroundWorker and closing an OleDbConnection

Hi,

I am new at using the BackgroundWorker so please forgive me if this topic
has already been covered.

I'm using BackgroundWorker to import data into an Access 2000 database using
OleDbConnection. After the thread is complete, I'm noticing that the Access
..ldb lock file still remains, and does not disappear until I close all the
way out of my program. Since the call to Open the OleDbConnection is inside
of the thread (in the DoWork function) how can I force the OleDbConnection
to Close so I can rename my .mdb file?

TIA!!

--Eric

Jan 8 '07 #1
6 2729
Why not just call .Close() or .Dispose on the connection object in the
thread? I believe you can use the "using" block to do this same thing
(it's only in VS2005 though)

Thanks,

Seth Rowe
eforden wrote:
Hi,

I am new at using the BackgroundWorker so please forgive me if this topic
has already been covered.

I'm using BackgroundWorker to import data into an Access 2000 database using
OleDbConnection. After the thread is complete, I'm noticing that the Access
.ldb lock file still remains, and does not disappear until I close all the
way out of my program. Since the call to Open the OleDbConnection is inside
of the thread (in the DoWork function) how can I force the OleDbConnection
to Close so I can rename my .mdb file?

TIA!!

--Eric
Jan 8 '07 #2
Hi Seth,

I should have specified that I am using VS2005, and already do have my
connection setup in a Using block - that's why I'm kinda stumped why it
isn't releasing the resource.

I've tried .Close and .Dispose, they don't appear to have any effect.

Any other ideas?

Thanks!!

--Eric

"rowe_newsgroups" <ro********@yahoo.comwrote in message
news:11**********************@s34g2000cwa.googlegr oups.com...
Why not just call .Close() or .Dispose on the connection object in the
thread? I believe you can use the "using" block to do this same thing
(it's only in VS2005 though)

Thanks,

Seth Rowe
eforden wrote:
>Hi,

I am new at using the BackgroundWorker so please forgive me if this topic
has already been covered.

I'm using BackgroundWorker to import data into an Access 2000 database
using
OleDbConnection. After the thread is complete, I'm noticing that the
Access
.ldb lock file still remains, and does not disappear until I close all
the
way out of my program. Since the call to Open the OleDbConnection is
inside
of the thread (in the DoWork function) how can I force the
OleDbConnection
to Close so I can rename my .mdb file?

TIA!!

--Eric

Jan 8 '07 #3
Just a long shot, have you tried adding GC.Collect() to the end of the
routine?

Thanks,

Seth Rowe
eforden wrote:
Hi Seth,

I should have specified that I am using VS2005, and already do have my
connection setup in a Using block - that's why I'm kinda stumped why it
isn't releasing the resource.

I've tried .Close and .Dispose, they don't appear to have any effect.

Any other ideas?

Thanks!!

--Eric

"rowe_newsgroups" <ro********@yahoo.comwrote in message
news:11**********************@s34g2000cwa.googlegr oups.com...
Why not just call .Close() or .Dispose on the connection object in the
thread? I believe you can use the "using" block to do this same thing
(it's only in VS2005 though)

Thanks,

Seth Rowe
eforden wrote:
Hi,

I am new at using the BackgroundWorker so please forgive me if this topic
has already been covered.

I'm using BackgroundWorker to import data into an Access 2000 database
using
OleDbConnection. After the thread is complete, I'm noticing that the
Access
.ldb lock file still remains, and does not disappear until I close all
the
way out of my program. Since the call to Open the OleDbConnection is
inside
of the thread (in the DoWork function) how can I force the
OleDbConnection
to Close so I can rename my .mdb file?

TIA!!

--Eric
Jan 8 '07 #4
Well that long shot definitely solved my issue, thank you so much for that
tip!!

--Eric
"rowe_newsgroups" <ro********@yahoo.comwrote in message
news:11**********************@i15g2000cwa.googlegr oups.com...
Just a long shot, have you tried adding GC.Collect() to the end of the
routine?

Thanks,

Seth Rowe
eforden wrote:
>Hi Seth,

I should have specified that I am using VS2005, and already do have my
connection setup in a Using block - that's why I'm kinda stumped why it
isn't releasing the resource.

I've tried .Close and .Dispose, they don't appear to have any effect.

Any other ideas?

Thanks!!

--Eric

"rowe_newsgroups" <ro********@yahoo.comwrote in message
news:11**********************@s34g2000cwa.googleg roups.com...
Why not just call .Close() or .Dispose on the connection object in the
thread? I believe you can use the "using" block to do this same thing
(it's only in VS2005 though)

Thanks,

Seth Rowe
eforden wrote:
Hi,

I am new at using the BackgroundWorker so please forgive me if this
topic
has already been covered.

I'm using BackgroundWorker to import data into an Access 2000 database
using
OleDbConnection. After the thread is complete, I'm noticing that the
Access
.ldb lock file still remains, and does not disappear until I close all
the
way out of my program. Since the call to Open the OleDbConnection is
inside
of the thread (in the DoWork function) how can I force the
OleDbConnection
to Close so I can rename my .mdb file?

TIA!!

--Eric

Jan 8 '07 #5
Glad I could help!

Thanks,

Seth Rowe
eforden wrote:
Well that long shot definitely solved my issue, thank you so much for that
tip!!

--Eric
"rowe_newsgroups" <ro********@yahoo.comwrote in message
news:11**********************@i15g2000cwa.googlegr oups.com...
Just a long shot, have you tried adding GC.Collect() to the end of the
routine?

Thanks,

Seth Rowe
eforden wrote:
Hi Seth,

I should have specified that I am using VS2005, and already do have my
connection setup in a Using block - that's why I'm kinda stumped why it
isn't releasing the resource.

I've tried .Close and .Dispose, they don't appear to have any effect.

Any other ideas?

Thanks!!

--Eric

"rowe_newsgroups" <ro********@yahoo.comwrote in message
news:11**********************@s34g2000cwa.googlegr oups.com...
Why not just call .Close() or .Dispose on the connection object in the
thread? I believe you can use the "using" block to do this same thing
(it's only in VS2005 though)

Thanks,

Seth Rowe
eforden wrote:
Hi,

I am new at using the BackgroundWorker so please forgive me if this
topic
has already been covered.

I'm using BackgroundWorker to import data into an Access 2000 database
using
OleDbConnection. After the thread is complete, I'm noticing that the
Access
.ldb lock file still remains, and does not disappear until I close all
the
way out of my program. Since the call to Open the OleDbConnection is
inside
of the thread (in the DoWork function) how can I force the
OleDbConnection
to Close so I can rename my .mdb file?

TIA!!

--Eric
Jan 9 '07 #6
Eric,

Be aware that a thread is normally not direct automaticly destructed if it
ends. Doing that can be very inefficient, so take care what you are doing.

Cor
"eforden" <eforden_nospam@proserve-solutions_nospam.comschreef in beric

ht news:uN**************@TK2MSFTNGP04.phx.gbl...
Well that long shot definitely solved my issue, thank you so much for that
tip!!

--Eric
"rowe_newsgroups" <ro********@yahoo.comwrote in message
news:11**********************@i15g2000cwa.googlegr oups.com...
>Just a long shot, have you tried adding GC.Collect() to the end of the
routine?

Thanks,

Seth Rowe
eforden wrote:
>>Hi Seth,

I should have specified that I am using VS2005, and already do have my
connection setup in a Using block - that's why I'm kinda stumped why it
isn't releasing the resource.

I've tried .Close and .Dispose, they don't appear to have any effect.

Any other ideas?

Thanks!!

--Eric

"rowe_newsgroups" <ro********@yahoo.comwrote in message
news:11**********************@s34g2000cwa.google groups.com...
Why not just call .Close() or .Dispose on the connection object in the
thread? I believe you can use the "using" block to do this same thing
(it's only in VS2005 though)

Thanks,

Seth Rowe
eforden wrote:
Hi,

I am new at using the BackgroundWorker so please forgive me if this
topic
has already been covered.

I'm using BackgroundWorker to import data into an Access 2000
database
using
OleDbConnection. After the thread is complete, I'm noticing that the
Access
.ldb lock file still remains, and does not disappear until I close
all
the
way out of my program. Since the call to Open the OleDbConnection is
inside
of the thread (in the DoWork function) how can I force the
OleDbConnection
to Close so I can rename my .mdb file?

TIA!!

--Eric


Jan 9 '07 #7

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

Similar topics

1
by: Keith | last post by:
Hi, if have this method in a cs file that connections to a database and returns a datareader to my web form. public OleDbDataReader GetDataReader(string theSQL) { theConn = new...
7
by: Arsalan | last post by:
I have a function which return datareader Public Shared Function ReturnDReader(ByVal query As String) As OleDbDataReader Dim Connection_String As String =...
2
by: Sagaert Johan | last post by:
Hi I have a problem with an mdb file still being locked after i closed the OleDBConnection. (can't rename or delete the file) Is there anything that still has some open filehandle to the mdb ?...
5
by: Rob R. Ainscough | last post by:
I'm using a BackgroundWorker to perform a file download from an ftp site. Per good code design practices where I separate my UI code from my core logic code (in this case my Download file method in...
1
by: Bob | last post by:
Hi, I am having trouble seeing how this bolts together. The UI starts a process which involves a long running database update. All Database activity is handled by a class called DT. DT has a...
14
by: =?Utf-8?B?SXNobWFlbA==?= | last post by:
Hi, I have a form with a progress bar on it and wanted to use the BackgroundWorker to be able to update the progress. I looked at examples, run some of them, but in debug, when the code gets to...
9
by: RvGrah | last post by:
I'm completely new to using background threading, though I have downloaded and run through several samples and understood how they worked. My question is: I have an app whose primary form...
1
by: Mel | last post by:
I am performing the same recordset multiple times, just passing different parameters each time. Is there a way to do this more efficiently without having to close and re-open the connection and...
0
Plater
by: Plater | last post by:
So it occured to me that I told people to use this to solve some thread-safeing issues, but that I had not been using it myself (I had been using a delegate with invokerequired which seemed to lock...
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
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?
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
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
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
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.