How to open Database in TideSDK app

by THavamani 2013-04-29 16:52:23

There are two ways to use databases in TideSDK
In both cases,SQLite a is Database..

Method One:

You can open databases in TideSDK using the Ti.Database.open

Ti.Database.open will create a database in the same directory(Only if the database file doesn't exist.)

Code for method one:

var db = Ti.Database.open('customdatabase');



Method Two:

Alternatively, you can create a database using the Ti.Database.openFile methods.
This method accepts a file path or a Ti.Filesystem.File object.


Code for method one:


var db = Ti.Database.openFile(Ti.Filesystem.getFile(
Ti.Filesystem.getApplicationDataDirectory(), 'customdatabase.db'));


Ti.Filesystem.getFile is used to mention the directory to database
689
like
0
dislike
0
mail
flag

You must LOGIN to add comments