INSERT and SQLlite command"

JOHN PATTEN johnpatten at me.com
Thu Apr 23 12:26:15 EDT 2015


Hi All,

I have a very simple SQL Lite database consisting of three fields, an ID (INTEGER PRIMARY KEY) and two basic fields (technology char(200) and notes char(200).

I am trying to INSERT records into the database.

This works:

 repeat with x=1 to the number of items in tTopics
      put item y of tTopics into $technology
      put item y of tTopics into $notes
      put "INSERT into teacher_notes VALUES (null,'" & $technology & "','" & $notes & "');" into tSQL
      revExecuteSQL tDatabaseID, tSQL

This doesn’t work:

repeat with x=1 to the number of items in tTopics
      put item y of tTopics into $technology
      put item y of tTopics into $notes
      put "null" into $id
      put "INSERT INTO teacher_notes(" & return & \
            “id, technology, notes)" & \
            "VALUES(" & return & \
            "1:, 2:, 3:)" into tSQL
      --answer tSQL
      revExecuteSQL tDatabaseID, tSQL, "$id", "$technology", "$notes”

Can anybody point out what I’m missing in the second version?  

Thank you!

John Patten
SUSD






More information about the Use-livecode mailing list