Quick Titanium Desktop Database Creation Tutorial
Figuring out how to use the Desktop APIs can be tough since they're not well documented and the code snippets (if there) may be out of date.
Anyway, Titanium.DB's code snippert suggests that the way to open a database is with a line of code similar to…
var db = Titanium.Database.openFile(Titanium.API.application.dataPath, "data.db");
This implies that the way to call it is with a two-part argument of the path and the file name, separated by a comma. And every time I've tried that, I've failed.
But the truth is, the meager API documentation says it only accepts a full path to a file. So I crunched the two togther…
adp = Titanium.API.Application.getDataPath();
dbpath = adp + "/thatlovely.db";
var db = Titanium.Database.openFile(dbpath);
This works. code after it executes and I can find it in the AppData directory on Windows 7.
1 Answer
-
what i have to do for create new database in desktop.Let i have to create db name as 'mydatabase'.if i write
Titanium.Database.open('mydatabase');
then it doest not create it.Please help me out.