Widget demo that shows a sqlite row inside a Listview1 example

Hello,

I am creating a demo to Krone in which the application loads an SQLite file and displays it through the ListView widget.

To do that I’m using the documentation and examples:

ListView1 Demo

SQLite Demo

And I’m trying to merge the two to create the new examples but it seems that something I’m doing wrong. I attached the demo code if you can comment me some detail that I’m wrong.

Thank you very much!

Hi. I looked at your code and noticed few issues with it. The tabBar is causing problems because you are not giving it any buttons. For your initial tests, I would suggest getting rid of it. 

Your db contains the table you are interested in but your code does not check if it exists on the device and if not copy it to the device. This does not happen automatically. Your code simply creates an new copy in empty state and leaves that on the device. As a result your select * SQL statement is complaining that the table is not there… 

Hope these give you some ideas to look at. Good luck!

“…I’m trying to merge the two…”

I didn’t look at your code, but I’m not sure about the wisdom of merging those two things. I’d suggest using SQLite routines to fill a Lua table with data, and then using the data in that table to populate the list. Making SQL calls from inside the list code *might* be the best way to handle a specific task, but in most cases I’d advise against that.

By breaking things up like that it’s usually easier to get different pieces working together.

 Jay

PS - Plus, what ksan said since he actually looked at the code. :wink:

Hi. I looked at your code and noticed few issues with it. The tabBar is causing problems because you are not giving it any buttons. For your initial tests, I would suggest getting rid of it. 

Your db contains the table you are interested in but your code does not check if it exists on the device and if not copy it to the device. This does not happen automatically. Your code simply creates an new copy in empty state and leaves that on the device. As a result your select * SQL statement is complaining that the table is not there… 

Hope these give you some ideas to look at. Good luck!

“…I’m trying to merge the two…”

I didn’t look at your code, but I’m not sure about the wisdom of merging those two things. I’d suggest using SQLite routines to fill a Lua table with data, and then using the data in that table to populate the list. Making SQL calls from inside the list code *might* be the best way to handle a specific task, but in most cases I’d advise against that.

By breaking things up like that it’s usually easier to get different pieces working together.

 Jay

PS - Plus, what ksan said since he actually looked at the code. :wink: