SQlite component, invalid sql statement

When first time app opens in companian and in apk it shows error that invalid sql statement but i open same app second time it works without showing error as expected. What should i do to resole this?

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select “Download Blocks as Image”. You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun

2 Likes

blocks

blocks (2) blocks (1)

here are the relevant blocks.

can you post the complete CREATE TABLE statement?
are you able to insert records into the table successfully?

Also what happens, if you do a Do it onto the RawQuery block?
use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools

as the error occurs in both the companion app and after building the app, it looks like it is not a permission issue…

Taifun

Did You try ?

CREATE TABLE IF NOT EXISTS “products” ( “id” INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, “productname” TEXT NOT NULL);

and

Select * from products

Here, works :+1:t2:

After Query, the result should be:
((1 Ball ) (2 Racket) (3 Wristband) (4 Sock))

For Insert use this blocks :
Make List for fields names and fields values ant text block to table name.
Insert Sqlite