i’m very confuse when I want to insert so many field’s data into sqlite, any better format to insert the data into sqlite ?
Do you have a bunch of data in an excel sheet or a text file (CSV?) that you want to import? If so that is easy to do with a SQL lite browser. I use:
http://sqlitebrowser.sourceforge.net/
Or are you saying there is a lot of data you want your user to populate dynamically? If so you pretty much have to write out the insert statements.
About:
local tablefill =[[INSERT INTO mathsquerylib (id,cate,grade,desc\_chn,desc\_eng,desc\_hk,ans,math\_sign
VALUES (NULL, ']]..cate..[[',']]..grade..[[',']]..desc\_chn..[[',']]..desc\_eng..[[',']]..desc\_hk..[[',']]..ans..[[',']]..math\_sign..[[');]]
I’m not sure what you’re trying to do here. It looks like you’re trying to concat variables.
Can’t you use a String for an db statement rather than a table? I haven’t worked on my corona app in awhile, but I think I remember using strings instead of tables, ie something like:
local insertStatement = "insert into mathsquerylib(id,cate,grade,desc\_chn,desc\_eng,desc\_hk,ans,math\_sign) VALUES (NULL, '"..cate.. "','" ..grade.."','"..desc\_chn.."','"..desc\_eng.."','"..desc\_hk.."','"..ans.."','"..math\_sign.. "'")
I’ll check for you in a few hours when I get home. JKrassman gave some good advice, when debugging a SQL statement like this, print it out to the console and see exactly what you are passing to the SQL engine. When I run into trouble, I also write the actual SQL in whatever client I’m using (ie SQLDataBrowser, Aqua Data Studio, SQL Server Manager) and then write it in my code, print it out, and compare the two.
[import]uid: 112807 topic_id: 27197 reply_id: 110527[/import]