This is the partial code from the sample from Hardware–>SQLite. Once a table called ‘test’ is created, is this code all that is needed to access the table for the first time on a phone? In the simulator it runs fine, but on the phone for the first time I get an error, “Runtime error, no such table found.” The table exists and has already been created, Ive looked in the Sandbox and I see it.
require “sqlite3”
local path = system.pathForFile(“data.db”, system.DocumentsDirectory)
db = sqlite3.open( path )
local function onSystemEvent( event )
if( event.type == “applicationExit” ) then
db:close()
end
end
for row in db:nrows(“SELECT * FROM test”) do
local text = row.content…" "…row.content2
local t = display.newText(text, 20, 120 + (20 * row.id), native.systemFont, 16)
t:setFillColor(1,0,1)
end
Runtime:addEventListener( “system”, onSystemEvent )
Do I need to have db:exec in here at some point?
Thanks in advance.