WinJsApps : JSSqliteDB.dll, SQLiteDatabase for WinJsApps

Directory Structure :

WinJSApps :
		- dll :
			- sqlite :
				- ...
				- ...
				- ...
		- WinJsApps.exe
		- WinJsApps.exe.config 
		- ...
		- ...

Load DLL object from javascript

var sqlitedll =  window.external.loadDll("sqlite/JSSqliteDB.dll");

Sqlite database connection

Get Sqlite database connection

 var curdir  = window.external.getCurrentDirectory().replace(/\\/g,"/");  
 var sqlitedll =  window.external.loadDll("sqlite/JSSqliteDB.dll");
 var dbcon = sqlitedll.getCon(curdir + "/dmydb.db");


To execute query the command tools must created from connection with sqlite query as parameter, for example how to get SqliteCommandTools

var query = "SELECT * FROM TableBarang";
	var command = dbcon.createCommand(query);

the next, “execute” or “executeReader” or “executeReaderAsyn” can be call from the command tools

execute (void)
command.execute() is void, no return,. specifically using for query that no need a result, like create, insert, update, delete etc.


executeReader (String)
executeReader will return json string (synchronous)

	var jsonstring = command.executeReader();

executeReaderAsync (void)
Call executeReader with asynchronous method, this void need javascript object with function “result” as member, the “result” will call after executeReader finished, and string result will send to the “result” function as parameters.

var command = dbcon.createCommand("SELECT * FROM TableBarang");		 
		result : function(json){

Download WinJsApps here :