sqlite3 how to update text

Hi,

I try to update the text data but it isn’t update

Here is some code:
 

require “sqlite3”

local path = system.pathForFile(“data.db”, system.DocumentsDirectory)

db = sqlite3.open( path )   

local tablesetup = [[CREATE TABLE IF NOT EXISTS data (id INTEGER PRIMARY KEY autoincrement, text);]]

db:exec( tablesetup )

local t = “Old text”

local q = [[INSERT INTO data VALUES (NULL, ‘]] … t …[[’);]]

db:exec( q )

for row in db:nrows(“SELECT * FROM data WHERE id = 1”) do 

    print(row.text)

end

local t = “New text”

local Update = [[UPDATE data SET text =]] … t … [[WHERE id = 1]]

db:exec(Update)

for row in db:nrows(“SELECT * FROM data WHERE id = 1”) do

    print(row.text)

end

How can i do?

You need to put quotes in your update line…

[lua]local Update = [[UPDATE data SET text = “]] … t … [[” WHERE id = 1]][/lua]

Hope this helps.

Craig

You need to put quotes in your update line…

[lua]local Update = [[UPDATE data SET text = “]] … t … [[” WHERE id = 1]][/lua]

Hope this helps.

Craig