Sub CreateTableIfNotExists
'Find all the tables in this database
Command.CommandText = "SELECT name FROM sqlite_master WHERE type = 'table' AND name='t_orders'"
'instantiate reader
Reader.New1
'Fill reader
Reader.Value = Command.ExecuteReader
If Reader.ReadNextRow = False Then
' No table with this name in the database.
' Create one.
Command.CommandText = "CREATE TABLE t_orders (ID INTEGER PRIMARY KEY, Sum REAL, TableNum INTEGER," & _
"SeatNum INTEGER, Hamburger INTEGER, French INTEGER, Coke INTEGER, Water INTEGER, " & _
"isServed INTEGER, Time TEXT)"
Command.ExecuteNonQuery
Else
'Close reader anyhow
Reader.Close
End If
End Sub