PDA

View Full Version : close all database connections


nature
02-06-2004, 04:47 AM
Is there a way for ado.net to close all open database connections (access)? If the page crashes, the connection remains open. Thanks!

msword
02-06-2004, 11:35 AM
Try
sQlCommand = New OleDbCommand(SqlString, SqlConnecti0n)

Try
SqlConnection.open()

SQLCommand.ExecuteNonQuery()
catch msg as Exception

response.write(msg.Message)
Finally
SQLconnect.Close()
end try

the finally is the key! if the statements fail, then it will print a message and close your db connection. you wont have the ldb hanging around. hope it helps