Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
| Search | Today's Posts | Mark Forums Read
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 25th, 2007, 11:24 AM
Authorized User
 
Join Date: Jul 2007
Location: Denver, CO, USA.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default Closing an ADO connection to a .DBF file

Hi all,

I would appreciate any help on this matter. I have created an ADO connection to a .DBF visual FoxPro DB in my MDI app in VB6. I can access data from this DB and update any data successfully.

However, I need to run another app within my MDI app that needs to access this .DBF DB. So, before launching this app, I make sure that the ADO connection is closed and I also set the connection object to "Nothing". According to VB help, this is sufficient to release the hold on the DB file. Unfortunately, the other app still reports that the file is in used, so it cannot gain access to it. To make it short, the other app is doing a backup of that DB, and it needs to get hold of the .DBF file.

Do you have any thoughts on why this happens? I would appreciate any help on how to resolve this. I'm nearing the end of the project, and need to resolve this issue soon.

Thank you very much for all your help.

Khoi.

PS: Below is my code to close the connection:


    tblSetupDBF.Close

    setupDBFConn.Close

    'Really free up the connection
    Set setupDBFConn = Nothing

It shouldn't be very complicated at all, at least that's what I thought.

Khoi Nguyen
__________________
Khoi Nguyen
 
Old July 25th, 2007, 01:44 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Hi there.. to a connection be close, it need to every recordset that it has open be close.. maybe you still has something opened around there that prevent the connection to be closed???

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old July 25th, 2007, 01:49 PM
Authorized User
 
Join Date: Jul 2007
Location: Denver, CO, USA.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the reply.... I don't think that's an issue, since I only have one recordset for that connection, and I already called Close() on it, before I closed the connection object.

Quote:
quote:Originally posted by gbianchi
 Hi there.. to a connection be close, it need to every recordset that it has open be close.. maybe you still has something opened around there that prevent the connection to be closed???

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
Khoi Nguyen




Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening ,dbf file through ADO in VB6? vchell VB Databases Basics 2 September 11th, 2007 03:43 AM
closing an inet1 connection renu2214 VB How-To 5 April 17th, 2007 09:31 AM
Closing Database Connection chrscote Classic ASP Databases 3 June 2nd, 2005 08:29 AM
Closing ADO connections in new page darrenw SQL Server 2000 0 September 15th, 2003 11:48 AM
How to connect .dbf file with ADO & DAO with code cbpanchal VB How-To 4 July 28th, 2003 10:14 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.