Missing step in SQL tutorial...

mjcoon

Well-Known Member
Licensed User
... but not in sample code.

Tutorial says:
B4X:
   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)"

      Reader.Close

      Command.ExecuteNonQuery

   Else

      'Close reader anyhow

      Reader.Close

   End If
whereas the code has the necessary extra line (as I discovered when I tried to run the code, and was explained by the desktop IDE message)
B4X:
      ' No table with this name in the database. 
      ' Create one. But first close the reader.
      Reader.Close
Mike.
 
Top