Imports System.Data
Imports System.Data.OleDb
Module Module1
    Public con As New OleDb.OleDbConnection 'for connection
    Public cmd As New OleDb.OleDbCommand 'to execute queries
    Public dr As OleDb.OleDbDataReader 'to read the result of the query
    Public ds As New DataSet  'to display table
    Public da As New OleDb.OleDbDataAdapter 'to display table
    Public dat As New OleDb.OleDbDataAdapter 'to display table

    Public pat, impt 'path of project and photos
    Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    'Public Declare Function Inp Lib "inpout32.dll" _
    'Alias "Inp32" (ByVal PortAddress As Integer) As Integer
    Public Declare Sub Out Lib "inpout32.dll" _
    Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)
   
    Public Sub cont() 'function is used to open the connection
        pat = "F:\projects of rameez 2009\projects of rameez 2009\parking rfid  without sensorMIT COLLEGE\rfid\WindowsApplication1\WindowsApplication1" 'project path
        impt = pat & "\photos\" 'photos path

        con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & pat & "\parking.mdb;Persist Security Info=False" 'database path
        If con.State = ConnectionState.Open Then
            con.Close()
        End If
        con.Open()
    End Sub
    Public Sub qry(ByVal s As String) ' function is used to execute select command
        If con.State = ConnectionState.Open Then
            con.Close()
        End If
        con.Open()
        cmd.Connection = con
        cmd.CommandText = s

        dr = cmd.ExecuteReader
    End Sub
    Public Sub qry1(ByVal s As String) 'function is used to execute insert,update,delete command
        If con.State = ConnectionState.Open Then
            con.Close()
        End If
        con.Open()

        cmd.Connection = con
        cmd.CommandText = s

        cmd.ExecuteNonQuery()
    End Sub
   
   
End Module
