inserting data into table

You must Login before you can answer or comment on any questions.

Hi i was trying to insert values into table bt it is showing error as "No such Table" Wrapped android.database.sqlite

3 Answers

Hi chaitanya

can you try this

var db = Titanium.Database.open('your_db');
        db.execute('INSERT INTO .....');
        db.close();
Regards

Nikunj

If the tables doesn't exists, you must create it before inserting any data.

Here's a sample on how it's done:
var db = Titanium.Database.open('your_db');
 
// This command will create the table if it's not present in the database 
// (usually on the first run)
db.execute('CREATE TABLE IF NOT EXISTS city (id INTEGER PRIMARY KEY, name VARCHAR(16) NOT NULL ...)');
db.execute('INSERT INTO city ....');
db.close();

titanium will create a db in the resource folder u can check their wheather the value is inserted or not.

Your Answer

Think you can help? Login to answer this question!