Module Module1

    Public dt As New DataTable
    Public ds As New DataSet
    Public inc As Integer
    Public editMode_student As Boolean = False
    Public sql_add, sql_update, sql_delete, sql_display As String

    Public Function myDBmodule() As OleDb.OleDbConnection

        Return New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\Database1.mdb")

    End Function

    Dim con As OleDb.OleDbConnection = myDBmodule()

    Public Sub mySQL(ByVal mysql As String)

        con.Open()

        Dim da As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(mysql, con)

        da.Fill(dt)

        con.Close()

    End Sub

    Public Sub mySQL_new(ByVal mysql As String, ByVal listview As DataGridView)

        Dim data_table As New DataTable

        con.Open()

        Dim da As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(mysql, con)

        da.Fill(data_table)
        listview.DataSource = data_table
        con.Close()

    End Sub


End Module
