#-Begin-----------------------------------------------------------------

  #-Sub Main------------------------------------------------------------
    Function Main() {

      #-Define connection string with the filename of the database------
      $DBDriver = "Driver=SQLite3 ODBC Driver;"
      $DBFile = "Database=C:\Dummy\sflight.sqlite;"
      $DBConnString = $DBDriver + $DBFile

      #-Open connection to database-------------------------------------
      $DBConnection = New-Object System.Data.Odbc.OdbcConnection `
        -ArgumentList $DBConnString
      $DBConnection.Open()

      #-Create SQL command----------------------------------------------
      $DBCommand = $DBConnection.CreateCommand()
      $SQLCmd = "SELECT * FROM sflight"
      $DBCommand.CommandText = $SQLCmd

      #-Execute SQL command---------------------------------------------
      try {
        $DBResult = $DBCommand.ExecuteReader()
        #-Get the number of fields in one record------------------------
        $DBCounter = $DBResult.FieldCount
        #-View result line by line--------------------------------------
        while ($DBResult.Read()) {
          for ($i = 0; $i -lt $DBCounter; $i++) {
            @{ $DBResult.GetName($i) = $DBResult.GetValue($i); }
          }
        }
      }
      catch {
        Write-Host "Database access error"
      }

      #-Close connection to database------------------------------------
      $DBConnection.Close()

    }

  #-Main----------------------------------------------------------------
    Main

#-End-------------------------------------------------------------------