How to install the database

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

var db = Titanium.Database.open('/model/details.sqlite') Ti.Database.install('/model/details.sqlite','done'); var rows=db.execute('SELECT * FROM kisan');

2 Answers

You first use install, then open.

var db = Ti.Database.install("/modem/details.sqlite", "done"); //this will make your database details to be installed AS a local database called done.

//next time you USE your application, you can use var db = Ti.Database.install("/modem/details.sqlite", "done"); //or var db= Ti.Database.open("done");

//if the database is already "installed" the install will act as open //and WILL NOT reinstall the database

//CAUTION //if you executed the open or de install, and you FAILED to install correctly, //then your subsequent "opens" will open a emtpy database. //you need to manually clear all data application at the app settings manager of the phone/tablet or emulator

hi, why you need to install the data base you can create it by var db=Ti.Database.open('done'). This will create the database done. only if not exists and if already exists then simply opens it. after that you can create your table as var sql=db.execute('Your QUERRY TO CREATE THE TABLE'). this is very simple

Your Answer

Think you can help? Login to answer this question!