0
기본 텍스트 필드의 데이터를 코로나의 sqlite 데이터베이스에 저장하는 데 어려움이 있습니다.nativeTextField의 데이터를 코로나의 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
}
나는 잘 작동하는 것 같다 "이 문자열입니다"와 같은 문자열로 db:exec([[ INSERT INTO test VALUES (NULL, textString, 30, "unknown")]])
에서 textString
을 변경하려고, 사람이 도움이 될 수 있습니다 : 여기
textString="hello world"
print([[ INSERT INTO test VALUES (NULL, textString, 30, "unknown")]])
print([[ INSERT INTO test VALUES (NULL,"]]..textString..[[",30,"unknown")]])
희망 :
어쨌든 도움을 주셔서 감사합니다. – philip