Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB Databases
|
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases 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 August 28th, 2004, 03:22 AM
Registered User
 
Join Date: Aug 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to close database opened by adodc

Dear all,

I used adodc to navigate through a database but when I close the program , the lock file which is created at the time of opening database won't be deleted and it would remain as the connection to database isn't closed. I tested different codes to close the database but it wasn't successful such as adodc1.recordset.close.

Thank you,
Azadeh


 
Old September 28th, 2004, 08:04 AM
Authorized User
 
Join Date: Sep 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Lalit_Pratihari
Default

Hi,

Try this out.

1. Add a reference to Microsoft ActiveX Data Objects 2.0 (or higher) Library.

2. declare a object of the connection object and the recordset.

3. Add the code before closing the application

lets say
Conn is the object for Connection
Rs is the object for Recordset

If Conn.State = adStateOpen Then
   Conn.Close
End if

If Rs.State = adStateOpen Then
   Rs.Close
End if

Hope this helps,

Lalit
Life Means More...;)





Similar Threads
Thread Thread Starter Forum Replies Last Post
When should you close the database connection? Stickannn Pro PHP 0 September 13th, 2007 04:25 AM
How to Close a Form when already Opened in C# akumarp2p C# 1 December 4th, 2006 09:45 PM
Database update on window close hemal_301080 ASP.NET 1.0 and 1.1 Professional 1 August 12th, 2006 02:34 PM
Close Database using VBA Stanny Access VBA 4 May 31st, 2006 01:49 AM





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