开发者

update and delete syntax in lua program

I am getting nil value when I tried to update the data for below code :

    local update_statement =db:prepare[[ UPDATE list SET :name :icon WHERE :id]]

    update_statement:bind_names{  name = aName,  开发者_StackOverflow中文版 icon = aIcon,  id = aId }

    update_statement:step()

    update_statement:reset()

And also I need the syntax for delete operation in lua program.

Please help me

Thank you, Madan mohan.


You need to learn SQL's syntax.

Basically, you're not telling which columns you want to update, you're only giving their values.

local update_statement = db:prepare[[ UPDATE list SET name = :name, icon = :icon WHERE id = :id]]

Here's the syntax for the DELETE statement:

local delete_statement = db:prepare[[ DELETE FROM list WHERE id = :id]]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜