SQLite CreateTable<> Database that already exists is replaced -


database exists replaced calling method createtable <> in sqlite windows 8, erasing lines , creating new table. how can solve? following code analyze:

using(var db = new sqlite.sqliteconnection(app.dbpath))         {              db.createtable<listasentid>();              if (db.executescalar<int>("select count(1) listasentid")==0)             {                 db.runintransaction(() =>                 {                     db.insert(new listasentid() { nome = "lista", eletros = "teste" });                 });              }         } 

not sure language using, if can execute raw sql can use following syntax:

create table if not exists listasentid (nome text, eletros text); 

this ensures table listasentid exists without nuking of previous data.


Comments

Popular posts from this blog

javascript - Unusual behaviour when drawing lots of images onto a large canvas -

how can i manage url using .htaccess in php? -

javascript - Chart.js - setting tooltip z-index -