close all database connections

Discussion in 'ASP.NET / ASP.NET Core' started by nature, Feb 6, 2004.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Is there a way for ado.net to close all open database connections (access)? If the page crashes, the connection remains open. Thanks!
     
  2. 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
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page