Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to really kill all actives ADODB.CONNECTIONS

Status
Not open for further replies.

3615

Programmer
Jun 22, 2001
22
FR
I'm trying to backup and restore a SQL7 database from a VB program using a SQL commands "BACKUP and RESTORE" via ADODB.connections.

To backup it no problems.

To restore a database it is necessary NO USER connected to the database.

I execute a RESTORE command using a connection to the MASTER database and it's ok if the VB program has not yet be connected.

I close all actives connection from my VB program before to restore, but it seems that there one connection opened because i got an Error message from SQLSERVER 7.

How to really kill all the actives ADODB.connections

Thanks.
 
Don't know but I need to also. This will put the message at the top again. Sorry if I got your hopes up for an answer. Every day above ground is a GOOD DAY!!!
 
See if a variation of this works.
i have no experience of what you are doing but I use a variation of this code to make sure I kill the open connection. I use a variation to see if it is closed as well, and if it is i open it.
Let me know what you think.
Also is you work from the one connection it should make things easier.
dbConnection is your active connection below.

If dbConnection Is Not Nothing Then
dbConnection.Close
Set dbConnection = Nothing
Else
If dbConnection.State = adStateOpen Then
dbConnection.Close
End If
End If
 
I'll give that a shot when I get to the point that I need it. I think I'll have too many databases to use one connection, but I'm just putting them together though.
Thx Every day above ground is a GOOD DAY!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top