INSERT and SQLlite command"

Peter Haworth pete at lcsql.com
Thu Apr 23 18:39:29 CEST 2015


Also, if id is your primary key, no need to provide a value for it,
although that does mean you will have to name the other two fields in the
INSERT statement.

Pete
lcSQL Software <http://www.lcsql.com>
Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>

On Thu, Apr 23, 2015 at 9:35 AM, JOHN PATTEN <johnpatten at me.com> wrote:

> Gosh darn it!
>
> Nevermind…
>
> I had the colon in the wrong spots  1: and 2: instead of :1 and :2 etc….
>
> Thanks anyways!
>
>
> > On Apr 23, 2015, at 9:26 AM, JOHN PATTEN <johnpatten at me.com> 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
>
>
> _______________________________________________
> 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