lundi 21 décembre 2015

Problems inserting SQLite database in javascript

I am creating a database in JS that way

 var db = openDatabase('exampleDB', '1.0', 'Database', 2 * 1048 * 1048);
    db.transaction(function (tx) {
        tx.executeSql('CREATE TABLE IF EXISTS alunos (ID INTEGER PRIMARY KEY AUTOINCREMENT, nome TEXT, data TEXT)');
    })

And it creates the table, but when i try to insert one record i have the following problem Uncaught ReferenceError: nome is not defined

 db.transaction(function (tx) {
                    tx.executeSql('INSERT INTO alunos (nome, data) VALUES(?,?)',[nome,data]);
                })

Where is the problem?

I have to add the plugin of SQLite?If Yes,How can i do that?

Thanks Guys

Aucun commentaire:

Enregistrer un commentaire