很难将本地文本字段中的数据保存到电晕中的 sqlite 数据库。
以下是一些相关代码:
function printrecord()
for row in db:nrows("SELECT * FROM test") do
t = display.newText(row.pname .. " " .. row.age .. " " .. row.desc, 20, 30 * row.id, null, 16)
t:setTextColor(255,255,255)
end
end
newData = native.newTextField ( 20, _H - 90, 280, 30 )
newData.inputType = "text"
saveData = function ( event )
textString = newData.text
db:exec( [[ INSERT INTO test VALUES (NULL, textString, 30, "unknown")]] )
t:removeSelf()
t = nil
printrecord()
end
savebutton = widget.newButton {
default = "buttonGreen.png",
over = "buttonGreenOver.png",
label = "Save",
embose = true,
onRelease = saveData
}
当我尝试将textString
from更改为db:exec( [[ INSERT INTO test VALUES (NULL, textString, 30, "unknown")]] )
“这是一个字符串”之类的字符串时,它似乎工作正常,有人可以帮忙吗?