Created
October 25, 2019 11:29
-
-
Save facebookegypt/3a62d3a6618020189a3694a7473fce19 to your computer and use it in GitHub Desktop.
Close all OleDB Connections to MS Access Database when exit application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'Close all OleDB Connections to MS Access Database when exit application | |
| 'adonetaccess2003.blogspot.com | |
| Public Sub CloseCN() | |
| If Not IsNothing(CN) Then | |
| For Each p As Process In Process.GetProcesses() | |
| If p.ProcessName = "MSACCESS" Then | |
| Try | |
| p.CloseMainWindow() | |
| p.Dispose() | |
| p.Kill() | |
| Catch ex As Exception | |
| Exit Sub | |
| End Try | |
| End If | |
| Next | |
| CN.Dispose() | |
| CN = Nothing | |
| End If | |
| End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment