|
Post by glscottmcsa on Mar 10, 2019 9:25:29 GMT -5
What do I need to change to not get this nasty error?
a$="1":b$="2":c$="3"$="4":e$="5" sqliteconnect #records, "c:\rbp101\PPeople.db" query$ = "Insert into c:\rbp101\PPeople.db (Last, First, Pref, Email, Phone) values (" query$ = query$ + chr$(34) + chr$(34) + a$ + chr$(34) + chr$(34) + "," + chr$(34) + chr$(34) + b$ + chr$(34) query$ = query$ + chr$(34) + "," + chr$(34) + chr$(34) + c$ + "," + chr$(34) + chr$(34) + d$ query$ = query$ + chr$(34) + chr$(34) + "," + chr$(34) + chr$(34) + e$ + chr$(34) + chr$(34) + ")" print query$ #records execute(query$) [ /pre]
this produces:
Runtime Error in program 'just a test': #records execute(query$) unrecognized token: ":" I used the print query$ to make sure I had to correct amount of quotes
|
|
|
Post by StefanPendl on Mar 10, 2019 14:23:35 GMT -5
The problem is the path to the DB file used by the insert command, this should be replaced by the name of a table. I would suggest rereading the SQLite help about the insert command. In addition, to simplify the code, you can use single quotes instead of double ones.
a$="1":b$="2":c$="3":d$="4":e$="5" sqliteconnect #records, "c:\rbp101\PPeople.db" query$ = "Insert into MyTable (Last, First, Pref, Email, Phone) values (" query$ = query$ + "'" + a$ + "','" + b$ + "','" + c$ + "','" + d$ + "','" + e$ + "')" print query$ #records execute(query$)
|
|