×

First time here?

You are looking at the most recent posts. You may also want to check out older archives. Please leave a comment, ask a question and consider subscribing to the latest posts via RSS or email. Thank you for visiting!

I’ve previously posted a few things about SQLite including a HOWTO on how to build from their source code.  If you still want to build your own DLL from their source code that is totally fine, but not necessary in most every single case I’ve seen in app usage.  One of the challenges I noted is that since SQLite is a native component and if you are a managed (.NET) app you can’t be architecture neutral anymore (AnyCPU).  What this means is that you have to build your app for each architecture you want to support: x86, x64 and ARM.  The flow of this using SQLite3.dll was that you would have to package, change the DLL, re-package. 

Not anymore.

In working with the great folks on the SQLite team, they’ve packaged the binaries up (for Windows 8 apps) in a nice installer using the Extension SDK format.  What this means is you now add a ‘reference’ to the SQLite binary and based on the architecture being built for your package, it will pull in the right DLL without you having to manage that yourself.  Here’s some step-by-step…

Installing the SQLite for Windows Runtime package

The first thing you want to do is install the package.  You can do this from within Visual Studio itself in all editions.  From the Tools menu, choose Extensions and Updates and then choose the Online section (on the left of the dialog) and search for ‘sqlite’ in the search term.  This will show you the SQLite for Windows Runtime package:

Visual Studio Extensions dialog

Click install my friends.  You will be prompted to restart Visual Studio which you should do.  Go ahead…I’ll wait.

Using the new package in your C#/VB app

Now that you have the SQLite for Windows Runtime package installed in your Visual Studio environment, you want to use it.  In a managed (.NET) app you would do the following steps.

First, create your app (e.g., a Blank XAML app is fine).  Once within your app, use the Add Reference mechanism to get to the next step.  Now you will not be browsing for any DLL directly like you would in a traditional .NET.  What we are adding here is a reference to the Extension SDK…not the library itself, a small but important distinction.  Once in the Add Reference dialog choose the Windows\Extensions view (see on left) and you’ll see SQLite for Windows Runtime.

To correctly use this in a managed app you’ll need to select that *and* the C++ runtime as seen below:

Add Reference dialog

The reason for this is to ensure that your app declares the right dependencies that are needed for the app to run.  The likelihood of the C++ runtime not being on a Windows machine where your app will be installed is extremely rare, but you need to declare this anyway.  Failure to do so will fail your app certification tests.

Now with this involved you can grab a managed wrapper to call the SQLite APIs as I’ve previously described in my HOWTO video.  I personally recommend the sqlite-net library (available via NuGet) to make this easier for you.

NOTE: sqlite-net is available as source in C#.  If you are using a VB app, you would first need to compile the sqlite-net source in a separate DLL so you can just add a reference to that in your VB project.

Using the sqlite-net library you can perform tasks using a model similar to LINQ2SQL where you can have types represent database entities:

   1: public sealed partial class MainPage : Page
   2: {
   3:     public MainPage()
   4:     {
   5:         this.InitializeComponent();
   6:         LoadData();
   7:     }
   8:  
   9:     public void LoadData()
  10:     {
  11:         var dbPath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "db.sqlite");
  12:         using (var db = new SQLite.SQLiteConnection(dbPath))
  13:         {
  14:             db.CreateTable<Person>();
  15:  
  16:             db.RunInTransaction(() =>
  17:                 {
  18:                     db.Insert(new Person() { FirstName = "Tim", LastName = "Heuer" });
  19:                 });
  20:         }
  21:     }
  22: }
  23:  
  24: public class Person
  25: {
  26:     [SQLite.AutoIncrement, SQLite.PrimaryKey]
  27:     public int ID { get; set; }
  28:     public string FirstName { get; set; }
  29:     public string LastName { get; set; }
  30: }

Now you just need to specify your architecture for your app (x86, x64, ARM) and when you build, the appropriate sqlite3.dll will be packaged in your app automatically.  This also happens during the packaging step for the store so the right item is included for each architecture-specific package.

WARNING: Do not package in DEBUG mode as you will fail certification.  Ensure that you build/package in RELEASE mode prior to submitting to the store or running the app certification toolkit (also referred to as WACK in some places).  You will get false positives if you are compiled in DEBUG mode.

This should make your development much easier without having to  swap out DLL files each time.

Using the new package in your C++ app

If you are a C++ developer you will do the same steps for installing and adding as a reference to your app.  In the C++ project system there is no 'Add Reference’ menu on the project context menu, but you will choose References and then the Add Reference button shows up.

Once you have the reference to the SQLite SDK then as a C++ developer you can just #include the header and go to work:

   1: #include <sqlite3.h>

Since C++ projects are already architecture-specific you don’t have to worry about the AnyCPU situation because there isn’t one!  You’ll get IntelliSense on the API by just including the header.  The Extension SDK mechanism already includes the C++ props file to help the project system know where to get the header for development and the lib for linking when building.  Most C++ developers will interact with SQLite using the native APIs and not need any additional wrapper library.

Using the new package in your JavaScript app

If you are using JavaScript/HTML to developer your app, you will follow the same flow as the C#/VB flow.  Add a reference to both the SQLite SDK as well as the C++ runtime (to declare the dependency).  As to accessing SQLite in your app, you’ll need a WinRT wrapper library to do that.  The one that seems to be gaining favor is the SQLite3-WinRT library on GitHub.  I have not personally used this, but seen a lot of people using this.  It allows you to use the JavaScript programming model in a familiar way:

   1: var dbPath = Windows.Storage.ApplicationData.current.localFolder.path + '\\db.sqlite';
   2: SQLite3JS.openAsync(dbPath)
   3:   .then(function (db) {
   4:     return db.runAsync('CREATE TABLE Item (name TEXT, price REAL, id INT PRIMARY KEY)');
   5:   })
   6:   .then(function (db) {
   7:     return db.runAsync('INSERT INTO Item (name, price, id) VALUES (?, ?, ?)', ['Mango', 4.6, 123]);
   8:   })
   9:   .then(function (db) {
  10:     return db.eachAsync('SELECT * FROM Item', function (row) {
  11:       console.log('Get a ' + row.name + ' for $' + row.price);
  12:     });
  13:   })
  14:   .then(function (db) {
  15:     db.close();
  16:   });

If using JavaScript this might be the way to go for your app.

Summary

I’m very glad the SQLite team worked to get this deployment package out there.  I think for some Microsoft developers, using SQLite is fairly new and this SDK package will make it easier to ensure you have the right bits at the right time.  Of course you are free to do it your own way, but I think this will ease the process a little bit.

Why no NuGet? Well, the NuGet infrastructure right now doesn’t support some of these semantics around native components to deal with headers, linking and architecture-specific deployments.  We’ll continue to work with them to see if we can drive these changes into that platform.

So please feel free to download via the Visual Studio ‘Extensions and Updates’ option from within VS, download directly from the Visual Studio Gallery, or download from the SQLite site themselves.  Once installed, once an update is available, VS will notify you that an update is available and you can install it.

Hope this helps!


This work is licensed under a Creative Commons Attribution By license.


8/7/2012 4:20 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
SQlite on windows 8 ;) That's what I was looking for. Thanks for clean and detailed instructions.
8/7/2012 9:11 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
This is fantastic! Thanks for the write up and your efforts to get a decent DB backend into WinRT.
8/8/2012 12:29 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Why are you not using the async sqlite-net api?
8/8/2012 11:07 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@ErikEJ - yes you could use that as well. Just showing an example here. One challenge is that the async stuff is still calling into a synchronous API...
8/8/2012 11:03 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
I added a reference for Sqlite for WINRT and C++ library but still i am not able to create a database in JavaScript app , it throwing "JavaScript runtime error: Class not registered " error how to fix this. plz help me out
8/9/2012 12:04 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi Tim,
Thanks for great post.

I have a problem with Sqlite and JS. Your process is working both on C# and C++ side, but it doesn't work on JavaScript side.

I got error "0x800a1391 - JavaScript runtime error: 'SQLite3' is undefined"

I checked the references and other stuff but I still got the error. I tried both direct access and "SQLite3-WinRT" library.

It seems that I can't access the reference. Is there anything to do access the reference?

A.
Gravatar
8/9/2012 7:22 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Very Cool....easy steps to follow and got it work in just few minutes
8/9/2012 8:35 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@hbsp/alper - the SQLite3-WinRT library is a bit different as it compiles the SQLite bits directly in their lib. It would have to be slightly modified to work. In theory you could probably just use that library but would have to manage the different versions (x86/x64/ARM) building yourself.
8/10/2012 2:56 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi Tim,

Not sure about the process to submit apps to store, Does that means need to compile separate build for x86, x64 and ARM and while submitting to store they would ask to upload 3 different packages?

Thanks to you and SQLite team !!

Sandy
8/10/2012 5:04 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Any recommendations for an ORM that will support relationships.

class Person {
int id;
int Name;
Address HomeAddress;
}

class Address {
int id;
string Street;
string Country;
}

If you do create table on person it should create the Address table too, and any select queries on Person would also return the associated address. I know EF/nHibernate do this, but unfortunately we don;t have System.Data anymore. Any ideas ?
8/10/2012 8:11 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@Sandy - yes you'd need to upload multiple packages. VS will help you create these easily.
8/10/2012 8:16 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@Peter - the SQLite-net library wouldn't be able to manage that automatically, no.
8/13/2012 7:57 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Do any of you guys know if there is any way to generate C# classes from the SQLite database in Window 8 WinRT, or how to work with design-first approach (if I already have SQLite database I want to use in my Metro project)? Something similar to SQLmetal (for WP7 + SQL CE)? Tutorial on this topic would be nice!
8/13/2012 10:33 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi, good article, work for me!!!

why you prefer sqlite before sql ce?
8/13/2012 10:39 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@Jimmy - because SQLCE is not available for one :-)
8/13/2012 11:06 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@joshueas - no I'm not aware of a tool that will do this for you.
8/13/2012 10:56 PM | # Deleting entry
How would I delete and entry in the database? I have been looking for hours but none of the examples seem to work.
8/14/2012 9:19 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
can I get some any C++ metro app sample?
8/14/2012 10:07 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@Luis - when you import the headers the C API should be available to you without any wrapper needed.
8/15/2012 3:46 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Now, I can open DB file, and insert and update.
But I don't know how to get data and output.

How to cast const unsigned char* to Platform::Object ^?
8/18/2012 5:17 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi, You wrote above "NOTE: sqlite-net is available as source in C#. If you are using a VB app, you would first need to compile the sqlite-net source in a separate DLL so you can just add a reference to that in your VB project."

Can you explain how i got about doing this - i am quite new to SQLite and don't really know what i'm doing.

8/19/2012 2:33 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@Justin - if you are using a VB project for your *APP* then you'll need to create a C# class library, add the SQLite-net code to that (I recommend via NuGet), compile that as a DLL, then add a reference from your *APP* to your newly created DLL. The SQLite-net is only distributed in source and only in C# so if you are using VB, you'll need this extra step. Here's a compiled version demonstrating: http://sdrv.ms/NzgRlR
8/20/2012 2:25 AM | # DLL only included in release package?
When debugging locally, everything works fine. But when I use the remote debugger it breaks and says it can't find the sqlite3.dll. (DLLNotFoundException).

Debugging in RELEASE mode however fixes this problem. It looks like the DLL only gets included when packaging in release mode.
Gravatar
8/21/2012 2:32 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps//Question on how to use the sqlite-net library in C#:
Question on how to use the sqlite-net library in C#:
I just successfully add reference to sqlite & sqlite-net to my Windows 8 style app project, and try the demo code in your description, and successfully create/insert new database/elements. Because I am not quite familiar with the sqlite-net API and DB operation, I hope you can show me a little more code using sqlite-net, how to query, how to delete, how to update ? Thanks so much >
8/21/2012 4:12 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@Michiel - actually this is due to the remote machine not having the debug version of the C++ runtime most likely -- are you using the VSIX installer? It should very much be deploying the sqlite3.dll -- just verified myself.
8/22/2012 1:41 PM | # Building from source directly in Visual Studio.
Hi Tim,

You wrote: "What this means is that you have to build your app for each architecture you want to support: x86, x64 and ARM. The flow of this using SQLite3.dll was that you would have to package, change the DLL, re-package."

I was struggling with this before I was referred to your article, and I worked out an alternate approach:

1.) Download the SQLite3 amalgamation and extract it.

2.) Create a C++ WinRT DLL project for the SQLite code, and remove the stub source files, headers, and precompiled headers.
a.) Add the sqlite3.c, sqlite3.h, and sqlite3ext.h files from the extracted amalgamation to the project.
b.) Open the property sheet for the project, set the scope to 'All Configurations' and 'All Platforms', and then update the following properties:
i.) Disable precompiled headers.
ii.) Add the preprocessor definitions: SQLITE_OS_WINRT;SQLITE_API=__declspec(dllexport)

I could then add a reference to the SQLite library project from my application project, and I can build and package for each platform and configuration straight from VS or using MSBuild.exe.
8/22/2012 8:05 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@John - or you could get the binaries from SQLite in the VSIX and do the same thing. That's what this updated post is about...it does it all for you using their supported/optimized build.
8/22/2012 8:22 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Yep, I only posted because I had come arrived at this just hours before someone pointed me at your page, so I thought I'd share the alternative.

Some other follow-ups on this:
1.) I had another project that I needed to add SQLite to, so I tried out installing the extension as you describe above. Works like a champ, thanks!
2.) Second the recommendation for SQLite-net if you need a really easy, lightweight marshaling between objects and SQLite.
3.) One thing that didn't work with building the WinRT DLL from source was that I couldn't add it to my C# unit test class library, whereas there was no problem using the VSIX package.
8/23/2012 9:59 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi Tim,

I am a iPhone Developer and have used your Sqlite DLL on the Mac and iPhone products for some time. I have developed over 40 apps that are in the iTunes store. Sqlite on the mac works great.

All of these apps use Sqlite and I access data from built in calls to SQlite - such as sqlite3_prepare_v2 , sqlite3_bind_int. ,sqlite3_column_double and so on.

I am in the process of porting my apps to Windows 8 Metro and have been working with sqlite-winrt-3071300.vsix and have followed the instructions for using the layers sqlite3-net.

I am programming in vb.

I find that I cannot access the Sqlite at the same level I did for the mac , i.e. I have no access to sqlite3_prepare_v2 , etc... Whomever developed sqlites-net assumed users want to use Linq to Sql only. Using Linq to Sql I have determined would take a huge effort on my part and many others who want to port apps from other platforms to Windows 8.

Is there a way I can access the low level calls in your winrt version of the software so one can access the lower level Sqlite calls? Is there a work around? If there is then I can port my apps to Winrt with a reasonable amount of effort. There are many others in the same boat who may not want to use Linq.

I have tried to call directly the SQLite statements such as the Prepare through the Ling to Sql layer c code (SQLite.cs) and can't get it to work , it of course was not designed to allow me to do what I want in the code. Perhaps that code could be enhanced to allows users to directly asscess the SQLite statements at the low level directly.

Thanks,

Jerry





8/23/2012 11:29 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@Jerry - you can get the *exact* same level of programmability you had with the other platforms you mentioned. The SQLite-net library is just that, a library. It is a community, open source project and as such was developed by individuals who scoped to the needs they felt. If you look at some of the methods you'd see that they do, in fact, call into prepare here. Additionally it provides you with the flexibility that if you do not want the LINQ experience, then you can simple execute commands at will using the Execute* methods. In the SQLite-net library the SQLite_prepare_v2 function is exposed as Prepare2.

I guess my point is this is the *same* SQLite you've been using. The library wrapper may be different and if it doesn't suit your needs, then don't use it. On iOS, given that it is a native platform and you're writing native code you were likely calling directly into the native APIs without a wrapper. You, of course, can still do this in a native app on windows without any wrapper required. .NET developers, however, aren't used to that and hence why you have a lot of helpful wrapper libs out there. If SQLite-net isn't doing what you need but you want to use it, I'd log a bug on the project, fork it and add the APIs you want, whatever.
8/27/2012 12:02 AM | # UPDATED HOWTO: SQLite with Windows 8 apps
Once I add references, I am getting error as below. Not sure What I am missing. According to this blog, this should support all build configurations.
Please help me on this.

Error 1 The processor architecture of the project being built "Any CPU" is not supported by the referenced SDK "Microsoft.VCLibs, Version=11.0". Please consider changing the targeted processor architecture of your project (in visual studio this can be done through the Configuration Manager) to one of the architectures supported by the SDK: "x86, x64, ARM". MyPasswordsDB
Error 2 The processor architecture of the project being built "Any CPU" is not supported by the referenced SDK "SQLite.WinRT, Version=3.7.13". Please consider changing the targeted processor architecture of your project (in visual studio this can be done through the Configuration Manager) to one of the architectures supported by the SDK: "x86, x64, ARM". MyPasswordsDB
8/27/2012 5:23 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi Tim,

Thanks for this article, really nice as usually.
question: is it possible to password protect or/and to encrypt the sqlite database ?

Thanks
8/27/2012 6:05 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Is it just me, or is this sqlite really, i mean really slow? My application uses simple database with 100 items * 10 tables = 1000 rows and startup time is almost 10 seconds (with simple select query). :-/
8/27/2012 8:45 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@Rosi - see my previous notes. You can't have an AnyCPU app with SQLite, you'll need to build for each architecture. When packaging this can be done in one step for you.

@Souch - there is a SQLite add-on to encrypt the database but I haven't tried it yet. My suspicion is that it should work, however may not pass store certification due to calling APIs that aren't approved for store apps.

@Joshueas - you are selecting all items immediately? and on the UI thread? if so, this would give your app the appearance of being UI locked. Depending on what you are doing you should reconsider what/when/how you are querying. Also, be sure to use transactions when running insert/update/deletes for better speed/reliability.
8/27/2012 2:43 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@Tim, yes, I'm trying to get essential data for the app's landing page. For testing, I've tried to reduce items in the database but with no luck -- poor results even with only ~100 records in the database in total. I've noticed main issue while creating connection to the database:

using (var db = new SQLite.SQLiteConnection(dbPath)) { } // this takes approx. 3 seconds

So if you are going to make more queries, with "connection per query" principle, you will get really slow application :( Is there any need for maintaining connections pool by the application itself or its handled by the sqlite "framework"?
8/27/2012 4:44 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@Joshueas - you could look at using the async methods in SQLite-net for some different considerations to change the "slow" perception.
8/27/2012 11:03 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Thanks fo your reply Tim.
One more question.
I am trying to create SqlLite database in the portable library. So that I can use the same assembly even for phone. But in portable assembly project, "System.Threading.Tasks;" namespace is not available.
Is it means that, there is no way to create SqlLite db in portable assembly?
8/28/2012 9:41 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@Rosi - the SQLite-net most likely won't work as portable as it uses p/invoke. See blogs.msdn.com/...
8/29/2012 12:05 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Thanks Tim for your response.
9/1/2012 5:19 AM | # Async?
In reply to EricJ you mentioned that "One challenge is that the async stuff is still calling into a synchronous API... "

If I understand this properly what you are trying to say is that internally it makes use of 'ResetEvent' something rather than 'Action<>'?
9/1/2012 8:45 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi Tim
I am trying to use SQLite-net in a background agent(in c#), from what I have read however due to the limitations in winMD projects this is not possible.
is this correct?
are there any ways around it?
could I compile SQLite-net as a dll and reference it in the background task? (like you suggest to those who use VB)
any help at all will be greatly appreciated.

Thanks
Tim
9/3/2012 11:26 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi Tim ,
I'm trying build after add library : SQLite for Windows Runtime package and Microsoft Visual C++ packet
and i get a message error :
Error 4 Error : DEP0800 : The required framework "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\Microsoft.VCLibs\11.0\.\AppX\Retail\ARM\Microsoft.VCLibs.ARM.11.appx" failed to install.
Windows cannot install package Microsoft.VCLibs.110 because the package requires architecture ARM, but this computer has architecture x64. NikkeiMetroApp
Can you help me ?
9/4/2012 8:54 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@tuandq - your details are in the error message :-) -- you are trying to run an ARM config on your x64 machine. You can't :-)
9/4/2012 6:45 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Can i run in X86 machine ?
9/4/2012 8:00 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@tuandq - you can't run an ARM app on x86...not the same processor architecture :-)
Gravatar
9/5/2012 2:07 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi Tim:
How to use command 'vacuum' ?
when using

SQLiteCommand dbComdEx2 = db.CreateCommand(string.Empty, string.Empty);
dbComdEx2.CommandText = "vacuum";
dbComdEx2.ExecuteNonQuery();
, and then SQLiteException {"CannotOpen"}
9/7/2012 1:34 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Tim, are you familiar with how System Center can be used to deploy Metro apps? When we deploy our app using System Center, the SQLite dependency is lost (exception that program can't find sqlite3.dll). It's in the appx package and built in Release/x64.

Any tips?
9/12/2012 9:32 AM | # SQLite for Windows Runtime - not showing up in Extensions and Updates on my dev system
Just wanted to point out something that is probably obvious to all of you geeks out there, but you never know...I've got VS2012 installed on a Windows Server 2008 R2 PC (my dev platform of choice because I also do a lot of back-end dev). When I invoke VS2012 and then invoke Extensions and Updates, and then search Online for sqlite, daaadaaadaaa, SQLite for Windows Runtime does not show up in the list of goodies that I can install.

Is VS2012 so smart that it knows that I can't do Win8 dev using this instance of VS2012, so it's actually filtering the extensions that I can install? Or is there some other reason that I cannot find the SQLite for Windows Runtime in my list of installable extensions?

Nother question...when is Microsoft going to support Win8 development on non-Win8 PCs?

thanks...rick
9/14/2012 2:33 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
"for Windows Runtime" means to me, that it should have winmd file, so it is accessible from any programming language. Please include winmd in this installable extension.
9/18/2012 11:55 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
will anyone say me the select and delete,update stmt>>>>
9/18/2012 5:05 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@magz - Are you not familiar with the SQL syntax?
select column1, column2 from tableName
delete from tableName where column1 = someValue
update tableName set column2=someValue where column1=someOtherValue

http://www.sqlite.org/lang.html
9/21/2012 10:00 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
keep getting

Error 2 The type or namespace name 'SQLite' could not be found (are you missing a using directive or an assembly reference?)
9/21/2012 10:43 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@Rajkumar - you probably are missing the nuget package reference to the SQLite-net library.
9/23/2012 5:33 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
I got the same error as Rajkumar. I added the reference to SQLite but there is a warning sign on it. Is this maybe the problem? But I don't know how to solve it. Still new with visual studio and app stuff cause I did only java things at this time.
9/23/2012 7:16 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Now I reinstalled the runtime package and recreated references. Now the warning sign is gone but still get the error:
Error 1 The type or namespace name 'SQLite' could not be found (are you missing a using directive or an assembly reference?)

Any Ideas?
Gravatar
9/23/2012 9:41 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi,
Great tutorial!
But just like this:
db.Insert(new Person() { FirstName = "Tim", LastName = "Heuer" });
Can you please tell the query for operations "update", "delete"?
Thanks in advance
9/23/2012 11:44 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
I solved my problems. Here my solutions:

Problem: Warning sign on the included reference to SQLite
As mentioned in the article you have to specify the architecture. In the build properties the cpu is default on "Any CPU". Choose one architecure and the warning sign will gone.

Problem: The type or namespace name 'SQLite' could not be found (are you missing a using directive or an assembly reference?)
Make sure you have two new files in your project after installing sqlite-net (SQLLite and SQLiteAsync). In my case there went something wrong during installation so that these two files weren't added to the project beside it marked as installed. I created a new project and did the procedure again... then it worked.

Hopefully it saves somebody some time. It got me hours to figure it out.
9/24/2012 8:30 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@Pierre -- glad you worked it out...if you note in my post above I mention that you need to pick an architecture when using SQLite :-)
9/25/2012 9:44 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
That's a great 'getting started' guide, Tim - many thanks.

I just need how to figure out how to override constraints (e.g. insert multiple records, skipping ones whose primary key already exists) and I'll be up-and-running.
9/26/2012 6:58 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi Tim,
Nice post helpful.
But I install SQLite (Version=3.7.14) following the steps in the blogspot in a new project. Debugging is set to Release but when I try to run the project i get the following errror
Error : DEP0700 : Registration of the app failed. An internal error occurred with error 0x80073D05. See http://go.microsoft.com/fwlink/?LinkId=235160 for help diagnosing app deployment issues. (0x80073cf6).
Mis I something?

Thank I advanced
Gravatar
9/26/2012 8:27 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
hello how does wp8 sdk use sqlite for winrt , i find wp8 doesn't reference winrt dll
9/29/2012 2:34 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
When I follow the steps for a C# Windows Store app using VS 2012 RTM on Windows 8, the 'Add Reference...' dialog does not show "Microsoft Visual C++ Runtime Package". I'm not sure why nobody else is seeing this. I installed Visual Studio 2012 RTM using the defaults.
9/29/2012 5:27 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
After doing a clean re-install of Windows 8 (which I needed to do anyway as it had accumulated 3 years of cruft) and VS 2012, the 'Add Reference...' dialog now shows the "Microsoft Visual C++ Runtime Package" option. Definitely wasn't there before.
10/2/2012 1:44 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi, I am developing a note taking app. User will write note and he can set some metadata like location, note date time, etc. I am using SQLite for metadata and note will be RTF file. Now I want to have skydrive sync for that app. So user can access/backup/restore notes and its metadata from any Windows 8 device. I can upload and download files easily, but what approach should I use to sync the SQLite database ? Please guide me with some sample code.
10/2/2012 2:56 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
When I try to install this from the extension manager I get a web request exception. If i try and download and install from the web page it gives me a "The file is not a valid VSIX package" and the log contains :

02/10/2012 10:55:32 - Microsoft VSIX Installer
02/10/2012 10:55:32 - -------------------------------------------
02/10/2012 10:55:32 - Initializing Install...
02/10/2012 10:55:33 - Microsoft.VisualStudio.ExtensionManager.InvalidExtensionPackageException: The file is not a valid VSIX package. ---> System.IO.FileFormatException: File contains corrupted data.
at MS.Internal.IO.Zip.ZipIOEndOfCentralDirectoryBlock.FindPosition(Stream archiveStream)
at MS.Internal.IO.Zip.ZipIOEndOfCentralDirectoryBlock.SeekableLoad(ZipIOBlockManager blockManager)
at MS.Internal.IO.Zip.ZipArchive..ctor(Stream archiveStream, FileMode mode, FileAccess access, Boolean streaming, Boolean ownStream)
at MS.Internal.IO.Zip.ZipArchive.OpenOnStream(Stream stream, FileMode mode, FileAccess access, Boolean streaming)
at System.IO.Packaging.ZipPackage..ctor(Stream s, FileMode mode, FileAccess access, Boolean streaming)
at System.IO.Packaging.Package.Open(Stream stream, FileMode packageMode, FileAccess packageAccess, Boolean streaming)
at Microsoft.VisualStudio.ExtensionManager.InstallableExtensionImpl.ReadVSIXManifestFromPackage(Stream vsixStream, CultureInfo preferredCulture)
--- End of inner exception stack trace ---
at Microsoft.VisualStudio.ExtensionManager.InstallableExtensionImpl.ReadVSIXManifestFromPackage(Stream vsixStream, CultureInfo preferredCulture)
at Microsoft.VisualStudio.ExtensionManager.InstallableExtensionImpl..ctor(String path, CultureInfo preferredCulture)
at VSIXInstaller.App.InitializeInstall()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()

Any ideas chaps,

Chris
10/2/2012 9:46 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@Chris - this seems like a corrupt download. For giggles try a different browser to download. Optionally, from within Visual Studio Extension manager search and download it from there.
10/2/2012 11:49 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Regarding the missing 'sqlite3.dll' when remote debugging with a DEBUG build, other than installing Visual Studio 2012 on the remote machine, is there another option to get the VC++ RT debug version installed on the remote machine so I can debug a DEBUG build?
10/3/2012 8:43 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi Tim,

managed to do it through the manager in the end. It was a permissions error with my new RTM machine!!

BTW one more question, can I use the same sqlite3.dll and reference it from normal .net projects, or do I need to recompile it? If so please say you have it (x64) already compiled. I know I could install the ado sqllite thing, but i don't want to, I want to use the library (sort-of) direct like the way with this metro extension does.
Gravatar
10/4/2012 6:59 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Tim - are there any recommended strategies on how to sync my Win 8 app (using SQLite) with the database hosted in Azure? I want my users to be able to access their data from either a Win 8 app or from an ASP.NET web app. At the same time, I want to allow users to interact with the Win 8 app even when not connected to the internet. So if I use SQLite (on the client), I need a way to sync up that data with the SQL database in the cloud when the app is connected. Thanks.
10/5/2012 8:29 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi Tim,

First, thank you for your article. I have a question about transactions. I use SQLite for JS and before using the SQLite dev team component this was working : db.runAsync("BEGIN TRANSACTION;", []); . Now I use the component and the new version of SQLite3JS and it's not working anymore. Are they any plans on getting this feature ?

Thanks,

Nicolas
Gravatar
10/9/2012 12:06 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi tim,
Great tutorial!
But just like this:
db.Insert(new Person() { FirstName = "Tim", LastName = "Heuer" });
Can you please tell the query for operations "update", "delete"? with where condtion.
please
Thanks in advance
10/11/2012 8:18 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Thanks for this great post.
I wanted to encrypt the db with a password. Is it possible with this approach???
Else can you please suggest me some other approach to achieve the same.

Thanks in advance
10/12/2012 9:42 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Also, will I be able to use joins with this approach???
10/17/2012 4:29 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Tim,

First thanks for the article - I've yet to get it working in VB.Net but give me a couple of hours and I'll get there.
Professionally as a seasoned .NET developer of 15+ years (I actually had the first asp.net e-commerce site in the UK) - it's crap that MS don't allow us to reference SQL Server (even if only the express editions). I have a MAJOR multinational who want's to use Metro for the next implementation of their app (which uses SQL Replication), and I can't access this major functionality! Who's idea was that? Is WinRT only for the likes of Angry Birds???? There are big companies out there willing to pay money for applications developed to work on phone, tablet and laptop with the same look and feel across all platforms.

OK - the majority of apps won't use SQL Server, but please give us the option of using System.Data.SqlClient if we need it. There are some of us out there that need this functionality! We also have the IT depts. to do the necessary installation of the SQL Express editions on the tablets to support the application (private - not downloadable from the store)

It seems that WINRT is targeted solely at "iStore" type applications, and completely ignores those of us who develop applications for third parties on a bespoke basis which aren't available to the general public. Are Microsoft trying to deliberately dumb down the development process?

I know I can use a standard desktop app - but this isn't what the client wants. They want a full-screen metro-style app with all the functionality of a local SQL Server. A very big banana skin as far as I'm concerned. Even SQLCE integration would have worked, but as usual, Microsoft knows best and completely ignores their core developers. Maybe it's time to move to a different platform and dump Microsoft altogether!
10/18/2012 4:05 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi I have followed the steps to build in VS2012 to create sqlite3.dll,
but it fails and giving errors as follows,

while entering the command (nmake -f Makefile.msc sqlite3.dll FOR_WINRT=1)

INAPI_FAMILY=WINAPI_FAMILY_APP -MD -DNDEBUG -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SE
CURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -DSQLITE
_THREADSAFE=1 -DSQLITE_THREAD_OVERRIDE_LOCK=-1 -DSQLITE_TEMP_STORE=1 -DSQLITE_E
NABLE_FTS3=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_
MAX_TRIGGER_DEPTH=100 -O2 -Zi -Fosqlite3.lo -c sqlite3.c
Microsoft (R) C/C++ Optimizing Compiler Version 17.00.50522.1 for x86
Copyright (C) Microsoft Corporation. All rights reserved.

sqlite3.c
sqlite3.c(12268) : error C2065: 'OPFLG_INITIALIZER' : undeclared identifier
sqlite3.c(12268) : error C2099: initializer is not a constant
sqlite3.c(57747) : error C2065: 'TK_REGISTER' : undeclared identifier
sqlite3.c(57754) : error C2065: 'TK_UMINUS' : undeclared identifier
sqlite3.c(57754) : error C2065: 'TK_INTEGER' : undeclared identifier
sqlite3.c(57754) : error C2065: 'TK_FLOAT' : undeclared identifier
sqlite3.c(57761) : error C2065: 'TK_STRING' : undeclared identifier
sqlite3.c(57761) : error C2065: 'TK_FLOAT' : undeclared identifier
sqlite3.c(57761) : error C2065: 'TK_INTEGER' : undeclared identifier
sqlite3.c(57770) : error C2065: 'TK_FLOAT' : undeclared identifier
sqlite3.c(57772) : error C2065: 'TK_INTEGER' : undeclared identifier
sqlite3.c(57772) : error C2065: 'TK_FLOAT' : undeclared identifier
sqlite3.c(57781) : error C2065: 'TK_UMINUS' : undeclared identifier
sqlite3.c(57795) : error C2065: 'TK_NULL' : undeclared identifier
sqlite3.c(57800) : error C2065: 'TK_BLOB' : undeclared identifier
sqlite3.c(58072) : error C2065: 'OP_ParseSchema' : undeclared identifier
sqlite3.c(58285) : error C2065: 'OP_Function' : undeclared identifier

do I have to do anything else to get the sqlite3.dll?
please reply
Thanks in advance.
10/18/2012 8:37 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi Tim! Great Post... I'm having a problem with the package certification, I have SQLIte in a class library to separate data access from the front end... however I keep failing the certification kit because of the dependency with the VC++ framework.. the error is the following:
"My App takes a dependency on Microsoft Visual C++ Runtime Package framework but is missing the framework dependency declaration in the manifest."

I don't know what to do... do you know how to fix this? I've already tried adding the dependency declaration on the manifest but it fails because I'm not providing the framework within the app...

10/24/2012 1:44 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi,

@Matias Laino
Did you find the issue since i am facing the same issue currently.

Thanks,

Ryan
10/25/2012 2:40 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@Mathias/Ryan - as indicated above you need to also add a reference to the C++ Runtime (via the same way you added the reference to SQLite)
10/25/2012 4:00 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Guys,
I appreciate Tims article and all of your comments. I am like Ric with a Server 2008 R2 (I like it), wanted a sqlite friendly platform, tried my VS Express tools and Extensions no luck saw that there was a licence issue. I then installed VS 2012 went to get sqlite not there again. (Server 2008 R2 is not too different from Windows 7 so I thought that people were fooling me). Ric made me believe again.
We are both linking a mobile device with the web.
I then found dotconnect. I then went searching for samples. I found this a buggy sample code.msdn.microsoft.com/.../Discussions - disaster
About this time I searched to find your article - sane people. My objective is to have a website with a sqlite backend. Any tips beyond this excellent article?
Thanks
10/29/2012 8:50 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
hi Tim, I just saw a big drawback in using SQLite, foreign keys are not activated by default, so I have do execute "PRAGMA foreign_keys=ON", is it supported to do it with CreateCommand?
10/30/2012 10:52 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Tim, what will happen if i dont use C++ at my reference?

I mean this coz my project got problem after i put then in. After i removed C++ reference my project running normaly.
10/31/2012 3:00 PM | # Issue with Connection string path if user name contains accented characters
Hi,
Great post and a really useful library. It's live now on my app on the W8 Store ... but there is a problem. The 'example code' at the top will not work if the user's name contains a non-ASCII character (for instance, an accented character).
The line: var db = new SQLite.SQLiteConnection(dbPath)) will throw an exception ('Could not open database file').
In Win8/RT you can reproduce this case by creating a new user (but not associating it with a LiveID at this stage) and giving a user name that includes an accented character. Then, logged on as that user, build and run a project as described in this article.
The code will try to create a DB file in C:\Users\(user name)\AppData\Local\Packages\(package name)\LocalState\db.sqlite, and will throw an exception. As far as I can see, a valid path is being passed into the sqlite3_open entry point, which expects a UTF-8 encoded string, but somewhere after that it all goes horribly wrong.
Any ideas? This is going to be an issue for *ANY* app in the store that uses SQLite, so I hope there is a solution.
Thanks,
Jim
10/31/2012 9:21 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@Jim - this is known and a fix was made in the SQLite-net library for the overload for SqliteConnection where you provide the flags...this will enable the Unicode char paths to work.
11/1/2012 3:16 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@Tim - thanks for that. It's working fine, using that overload. Maybe it would be worth changing the example code at the start of the post (or at least adding a footnote mentioning the Unicode issue)?
11/1/2012 11:58 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi Tim - Thanks to your guidelines I got a head-start on using SQLite, before it was available through NuGet. Now I want to port my Metro application from Windows 8 to Windows Phone 8. I have installed sqlite-net and the SQLite extension. But the sqlite.cs won't compile. Because of the WINDOWS_PHONE / USE_CSHARP_SQLITE compiler directives references to Community.CsharpSqlite now comes to live. But this namespace is not found in the project. How do I add it?
11/4/2012 8:11 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
I am having the exact same problem as Peter Naldal. How do we make it work for Windows Phone 8?
11/5/2012 4:03 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi Tim,
Got couple of questions here?
Does SQLite for WinRT support foreign key constraint ? Can you please guide me about that thing ? Thanks.
11/5/2012 4:59 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Just to follow up on my own question. I ended up using the CSharp port of sqlite to be able to use it on Windows Phone 8. In case anybody is interested
http://code.google.com/p/csharp-sqlite/
11/5/2012 11:16 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Just had 2 questions:
1)How to specify foreign key relationships between tables.. I came across Sqlite.Indexed attribute which does the same thing but it doesn’t specify which table it indexes..
2)Can we use the same for an WPF app??
11/6/2012 1:34 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Thank you Mr. Heuer! I just tripped over not setting the machine type, but otherwise, worked perfectly.
11/7/2012 9:36 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Thanks Nr. Heuer for your great write up:)
11/13/2012 2:35 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi tim how to create table in sqlite for winrt?
How to select distinc values of particular column in that created table?
11/17/2012 7:23 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi Tim,

I have a critical question considering SQLite. I developed an app and inserted some data into a local SQLite database. Pretty easy, pretty fine. Then, I just changed my splash screen image, selecting a different file from Package.appxmanifest. The database content was lost.

Does this mean that when I update an app, my users will lose all their saved content? Thank you in advance.

Regards,
Vangos Pterneas
11/20/2012 5:07 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Vangos, That depends on how you packaged the db file, if its set to content and you selected Copy Always then yes, it will overwrite all the time. If Copy if newer is selected then it won't overwrite all the time.
11/20/2012 9:25 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@CodeRewind

Thank you for your reply. I create the file dynamically in code. Although I get your point, I don understand how a Splash Screen affects the db. Anyway, I just place the db in a Library folder.
12/1/2012 5:14 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Thank you very much Tim!
This solved me a big problem!
Thanks!
12/3/2012 1:44 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi Tim,
This article give me a big help.
But when using Sqlite on Win8 App(C#), i meet a strange issue: if use string column as primary key, then update sql will return cannotopen error when run it in transaction more than once. I don't know why, Could you help me?
I use the sample on the article. Part code as follow:
Table:
public class Person
{
[ SQLite.PrimaryKey]
public string ID { get; set; } //change
public string FirstName { get; set; }
public string LastName { get; set; }
}
insert:
List<Person> dataList = new List<Person>();
using (var db = new SQLite.SQLiteConnection(dbPath))
{
db.RunInTransaction(() =>
{
for(int i = 0; i<2; i++)
{
dataList.Add(new Person() { ID = Guid.FirstName = "Tim", LastName = "Heuer" });
db.Insert(dataList[i]);
}
});
}
update:
using (var db = new SQLite.SQLiteConnection(dbPath))
{
db.RunInTransaction(() =>
{
for(int i = 0; i<dataList.Count; i++)
{
dataList[i].LastName = "For Test" ;
db.Update(dataList[i]); //Error when i = 1
}
});
}
12/5/2012 7:17 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi Tim,
Blog is very helpful.
I have query related to Unicode data. I am able to store and fetch the Unicode data in the SQLite table. But when I tried to search from table using WHERE clause which contains Unicode data like below -
cmd.CommandText = "SELECT * FROM Event WHERE Name LIKE '%" ++"%'"
List<Event> events = cmd.ExecuteQuery<Event>();
result no data. Please help.
12/23/2012 3:42 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi Tim, I had integrated SQlite 3.7 in my App, Its working great, I'm wondering it is possible to store StorageFile object in sqlite database, if it is possible please explain.
12/28/2012 2:15 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi Tim,

Can you able provide some info on how to take backup and restore of sqlitedb?

Thanks
1/9/2013 5:59 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
i add sqlite to my project as you suggested,it works well at the beginning.but when i add a new class library to my project,and i reference sqlite in the library ,and then declare new class using sqlite primarykey.i use this data class in another project of a same solution,after i create and add element to database,all the item has the same PK which is 0.why?helo me, thanks.
1/11/2013 1:13 PM | # SQLite with Windows 8 apps using Visual Basic
Hi Tim,

Great info on how to use SQLite with WinRT.

I am currently developing a WinRT app using Visual Basic. With the information learned from your website I am now able to connect and store data into SQLite database using Visual Basic.

My question is do you have any sample or example on how to read data from Sqlite using Visual Basic. I tried the ExecuteReader and ExecuteScalar but unfortunately there are not working.

All the info I am finding so far online relates to C# and not VB so this does not help me at all.

Thank you for the great work and hope for your reply soon.

Thierry
1/17/2013 5:34 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Thank you so much. I followed your article and it took 5 minutes to get set up and another 5 to write a few lines of code. This is exactly what I was looking for. Since I'm on an 86 machine, I had to set my project to target that. I assume the packaging part for the windows store will be self explanatory once I reach that step.
2/10/2013 6:09 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
HI Tim,
Thanks a lot for such great article, its helps. to let you know i am nowise to this platform. i was earlier used to work with .net but never used JavaScript with SQLite.
My Problem.

i am creating one form like registration and i wanted to store all things in SQLite. how can i ?, i know this is very basic Question but even i am asking cause i m eager learn this thing with JavaScript.

Thanks
Yagnesh
2/10/2013 6:37 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
hi..
i'm developing a windows store app and i'm in confusion in choosing the backend...I ve no idea abt the databases...so please suggest me a backend tool..and also I wanted to know the difference b/w SQLite and LINQ...Thanks in advance
3/11/2013 6:18 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi, do anyone know what is the problem in the following codes?

SQLite3JS.openAsync(dbPath)
.then(function (db) {
return db.runAsync('UPDATE Game SET highestScore = 57 WHERE id = 1')
})
.done(function (db) {
db.close();
});

It gives me the following error messages in JavaScript Console:

Exception was thrown at line 227, column 5 in Function code
0xa0040005 - JavaScript runtime error: The text associated with this error code could not be found.
WinRT information: The text associated with this error code could not be found.
3/22/2013 12:19 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi ,
I want to create a table at run time using SQLite where I would be giving the table name and column name dynamically. Is it possible to create and insert new columns dynamically?
Kindly help me with the code.

Thanks!!
4/4/2013 10:30 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi,
I have been working with the Sqlite Database on the Windows 8 App.
Turkish character problem when I insert or select the database.
How can I fix this problem. can you help me?
Thank you very much.
Easy come.
4/15/2013 11:28 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Thank you for your detailed information and instructions. I wanted to add Sqllite as the database to my windows 8 app. I am new in creating apps. Where am I supposed to add the package(coding) that you have listed in the beginning. Should i have add in the sqlite reference or somewhere else.. Please kindly help me. I am desperate in adding a database to my metro app.. Eagerly waiting for your reply.
4/15/2013 11:36 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Sorry to mention. I am developing using Javascript , HTML using CSS. How would I add the package of sqlite to my metro app??
4/23/2013 12:31 AM | # How to insert a record in Windows store App
How to insert a record in Windows store App using sqlite database in c# and xaml,inserting a record throung textboxes
6/6/2013 4:18 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Looks like a great tutorial. Thought it would be a great tool to get a feel for VS since I have never used it before and wanted to take a peek at it. I downloaded and installed the iso for VS Express 2012 for Desktop. I went to the TOOLS->Extensions and Updates and searched for SQLite after selecting "Online". The returned result is "No Items Found". I can search and display other packages. The VS install apparently installed the NuGet manager. I used the console and searched for the SQLite-net package and found it, but still could not locate any SQLite runtime. I know it must be something simple, but I am at a loss as to how to get the runtime package installed.

Appreciate any help and guidance.
8/19/2013 10:32 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Thanks a lot for such a straight forward explanation.

Really great tutorial would be referencing it for setting up SQLite for PhoneGap with Windows 8.

Thanks again.
8/23/2013 1:43 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
Hi,
I went through your tutorial and I have no luck setting up SQLite for Windows 8.

Any idea why I am getting the following error?

Additional information: Unable to load DLL 'sqlite3': The specified module could not be found. (Exception from HRESULT: 0x8007007E)


It is thrown at :

#if NETFX_CORE
SQLite3.SetDirectory(/*temp directory type*/2, Windows.Storage.ApplicationData.Current.TemporaryFolder.Path);
#endif
8/23/2013 1:49 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@Aravind - the main reason you get this usually is wrong architecture for the sqlite3.dll (e.g. you have a 32-bit DLL in a 64-bit app) or you have an older version of SQLite3.dll that doesn't have the SetDirectory API in it (which means you'd have a really old version)
11/11/2013 10:53 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
thats great but Is there anyway to encrypt data and then write it to sqlite db and decrypt it before putting it into UI..
12/13/2013 3:58 AM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
After i installed SQLite package in reference list it is grayed, and when I add reference is adds with yellow warning exclamation mark. What should be the reason?
12/16/2013 8:28 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
@Sergey - if you hover over the yellow exclamation mark it should tell you why. My assumption is that you are trying to reference an older SQLite package on an app that targets a later version. If you are building a Win8 app you need the Win8 version, Win8.1 needs the Win8.1 version. Both are available for download on their site at SQLite.org/downloads.html in the Windows Runtime section.
4/5/2014 11:11 PM | # re: UPDATED HOWTO: SQLite with Windows 8 apps
For those working with Visual Studio 2013 (aka Version 12) - you won't find the package add the in the Visual Studio Gallery. But you can find it here: www.sqlite.org/2014/sqlite-winrt81-3080403.vsix
Download, rename to vsix if needed, install and be happy :-)

 
Please add 8 and 7 and type the answer here:

DISCLAIMER:

The opinions/content expressed on this blog are provided "ASIS" with no warranties and are my own personal opinions/content (unless otherwise noted) and do not represent my employer's view in any way.