Solved

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

Posted on 2014-01-25
4
736 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article discusses how to create an extensible mechanism for linked drop downs.
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now