Solved

How to pre populate sqlite databse in Windows 8.1 RT application(HTML,Javascript/WinJS)?

Posted on 2014-01-25
4
749 Views
Last Modified: 2014-04-03
Hi All,

We are working on an app for Windows RT surface using HTML,Javascript/WinJS,CSS. For local database we are using SQLite3-WinRT plugin from https://github.com/doo/SQLite3-WinRT.

The SQLite database operations are working fine when we create db and its tables from the code,
but our requirement is to use an existing sqlite database and ship it with the application package(.appx) instead of creating db from code.

Could any one please let us know how to pre-populate an SQLite database file in a Windows 8.1 application?

Any code samples or tutorials would be really helpful.

 Thanks in advance.
0
Comment
Question by:dev-nbs
4 Comments
 
LVL 47

Expert Comment

by:dlethe
ID: 39809618
the sqlite database is a single file. Just build it as necessary and include the file and you are done.
0
 

Accepted Solution

by:
dev-nbs earned 0 total points
ID: 39814494
Thanks dlethe for valuable suggestion,

I got it solved by doing as follows:-
 
First i pasted my sqlite db in the project folder. Then in the db file properties set it to copy always.

Then for accessing the db file from JS/WinJS,  I have used the following code:-

var dbPath = Windows.ApplicationModel.Package.current.installedLocation.path + '\\mydb.db';

It worked! Now it is always copying my db file with application package and reading and updating data with the same sqlite db file.
0

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Owning a franchise can be the dream of a lifetime. It provides a chance for economic growth. You can be as successful as you want.  To make your franchise successful, you need to market it successfully. Here are six of the best marketing strategies …
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question