Imports System.Data
Imports System.Data.OleDb
Module connectDatabase
Public conStr = "Provider=Microsoft.JET.OLEDB.4.0;data source=" & filePatch & ";"
Public conn = New OleDbConnection(conStr)
Public Sub openConnection()
If conn.State = ConnectionState.Closed Then
conn.Open()
End If
End Sub
Public Function connectAcc(ByVal command As String) As DataSet
Dim a As New DataSet
a.Tables.Add(0)
Try
Dim da As OleDbDataAdapter = New OleDbDataAdapter(command, conn)
a.Tables.Clear()
da.Fill(a)
Catch ex As Exception
MessageBox.Show("Error" & ex.Message)
a.Tables.Clear()
a.Tables.Add(0)
Return a
End Try
Return a
End Function
End Module