I’m trying to return data from my db (created using Firefox SQLite Manger) but only receive a nil value.
I have successfully compile and run the sample app, but when I apply the same code to my db I get:
Runtime error
bad argument #1 to ‘_newText’ (string expected, got nil)
stack traceback:
[C]: ?
[C]: in function ‘_newText’
?: in function ‘newText’
/Users/bgb07a/Desktop/Corona SQLite/main.lua:23: in main chunk
Runtime error: bad argument #1 to ‘_newText’ (string expected, got nil)
stack traceback:
[C]: ?
[C]: in function ‘_newText’
?: in function ‘newText’
/Users/bgb07a/Desktop/Corona SQLite/main.lua:23: in main chunk
in the code:
for row in db:nrows(“SELECT * FROM zipcode”) do
local text = row.content
local t = display.newText(text, 20, 120, native.systemFont, 16)
t:setTextColor(255,0,255)
end
I’ve tried several different databases (all created with SQL Manager) and different sql calls, but always get ‘nil’.
Does anyone have any advise? If I put a counter in my for loop, it does read each of the records, but always returns nil.
Thank you for any help/advise!
Brian [import]uid: 6551 topic_id: 6576 reply_id: 306576[/import]