Missing step in SQL tutorial...

Discussion in 'Bug Reports' started by mjcoon, Dec 19, 2010.

  1. mjcoon

    mjcoon Well-Known Member Licensed User

    ... but not in sample code.

    Tutorial says:
    Code:
    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)
    Code:
    ' No table with this name in the database. 
          ' Create one. But first close the reader.
          Reader.Close
    Mike.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice