Created
February 10, 2016 11:04
-
-
Save k4m4r82/de02c82aeceac1f83bd4 to your computer and use it in GitHub Desktop.
This file contains 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
Option Explicit | |
Public Function GetOpenConnection() As ADODB.Connection | |
Dim conn As ADODB.Connection | |
Dim strCon As String | |
On Error GoTo errHandle | |
strCon = "DRIVER=SQLite3 ODBC Driver;Database=" & App.Path & "\db\Northwind.db;LongNames=0;Timeout=1000;NoTXN=0;SyncPragma=NORMAL;StepAPI=0" | |
Set conn = New ADODB.Connection | |
conn.ConnectionString = strCon | |
conn.Open | |
Set GetOpenConnection = conn | |
Exit Function | |
errHandle: | |
' do nothing | |
End Function | |
Public Sub CloseConnection(ByVal conn As ADODB.Connection) | |
If Not conn Is Nothing Then | |
If conn.State = adStateOpen Then conn.Close | |
Set conn = Nothing | |
End If | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment