INSERT and SQLlite command"

Mark Schonewille m.schonewille at economy-x-talk.com
Thu Apr 23 12:34:09 EDT 2015


Hi John,

What is the error you get?

Why do you have return in your syntax? Usually, SQLite syntax doesn't 
contain returns (even though it can). If you want to include a return as 
part of data, you need to encode or escape it.

Additionally, you're combining curly quotes with straight quotes. Don't 
mix them.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Installer Maker for LiveCode:
http://qery.us/468

Buy my new book "Programming LiveCode for the Real Beginner" 
http://qery.us/3fi

LiveCode on Facebook:
https://www.facebook.com/groups/runrev/

On 4/23/2015 18:26, JOHN PATTEN wrote:
> 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
>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>




More information about the use-livecode mailing list