Discussion:
SQLite for WinCE
Brian Wheatley
2012-11-24 18:30:49 UTC
Permalink
Hello,

I'm evaluating the SQLite database for future development projects. What I would like to know is: can SQLite be used in applications written using the .NET Compact Framework 2.0 on a Windows Embedded CE 6.0 device?

If so, what steps are necessary?

Does the source code amalgamation need to be recompiled?

And what about System.Data.SQLite?

Thanks in advance,
Brian Wheatley
Joe Mistachkin
2012-11-24 21:00:40 UTC
Permalink
Post by Brian Wheatley
What I would like to know is: can SQLite be used in applications written
using the .NET Compact Framework 2.0 on a Windows Embedded CE 6.0 device?
Yes, SQLite is supported on Windows CE and System.Data.SQLite helps support
the .NET Compact Framework 2.0.
Post by Brian Wheatley
If so, what steps are necessary?
1. Get the "PocketPC" binaries (or source code) for System.Data.SQLite,
from:

https://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki

2. Extract (or copy) the binaries into a directory like "Externals" inside
your project.

3. Add a reference to the System.Data.SQLite assembly.

4. Make sure that the SQLite.Interop.0XX.dll gets copied to the build output
and deployment directories.
Post by Brian Wheatley
Does the source code amalgamation need to be recompiled?
The necessary project files are included with System.Data.SQLite.

--
Joe Mistachkin
Brian Wheatley
2012-11-25 01:07:56 UTC
Permalink
Hello,

I've downloaded the source code for 1.0.82.0 of System.Data.SQLite and everything compiles without error (thankfully).

After compiling there's a SQLite.Interop.082.dll file in the folder labeled "Pocket PC2003 (ARMV4)".


Do I need to change the solution platform to the appropriate device before compiling? Or just leave it at mixed?

Also, there's no Interop file in the Win32 debug folder. When I try to run a PC application using the System.Data.SQLite.dll in the bin\2008\Debug\bin folder it throws an exception that SQLite.Interop.dll could not be found.

Thank you,
Brian Wheatley



________________________________
From: Joe Mistachkin <sqlite-UOTv/rETWm04Q++***@public.gmane.org>
To: 'General Discussion of SQLite Database' <sqlite-users-CzDROfG0BjIdnm+***@public.gmane.org>
Sent: Saturday, November 24, 2012 4:00 PM
Subject: Re: [sqlite] SQLite for WinCE
Post by Brian Wheatley
What I would like to know is: can SQLite be used in applications written
using the .NET Compact Framework 2.0 on a Windows Embedded CE 6.0 device?
Yes, SQLite is supported on Windows CE and System.Data.SQLite helps support
the .NET Compact Framework 2.0.
Post by Brian Wheatley
If so, what steps are necessary?
1. Get the "PocketPC" binaries (or source code) for System.Data.SQLite,
from:

https://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki

2. Extract (or copy) the binaries into a directory like "Externals" inside
  your project.

3. Add a reference to the System.Data.SQLite assembly.

4. Make sure that the SQLite.Interop.0XX.dll gets copied to the build output
  and deployment directories.
Post by Brian Wheatley
Does the source code amalgamation need to be recompiled?
The necessary project files are included with System.Data.SQLite.

--
Joe Mistachkin
Joe Mistachkin
2012-11-25 01:33:27 UTC
Permalink
Post by Brian Wheatley
After compiling there's a SQLite.Interop.082.dll file in the folder
labeled "Pocket PC2003 (ARMV4)".
Yes, that contains the native code for SQLite, compiled for Windows CE.
Post by Brian Wheatley
Do I need to change the solution platform to the appropriate device
before compiling? Or just leave it at mixed?
Leaving it mixed is fine. The only processor architecture supported
by the Windows CE project is ARM.
Post by Brian Wheatley
Also, there's no Interop file in the Win32 debug folder. When I try
to run a PC application using the System.Data.SQLite.dll in the
bin\2008\Debug\bin folder it throws an exception that SQLite.Interop.dll
could not be found.
The SQLite.Interop.dll file is only copied by the build process if the
selected processor architecture matches that of the machine performing
the build.

You might need to build the x64 SQLite.Interop.dll (by selecting x64
as the platform) and then manually copy the resulting DLL to the
directory containing the managed components.

--
Joe Mistachkin
Brian Wheatley
2012-11-26 14:47:57 UTC
Permalink
I have successfully compiled the source code, created a simple test application, and deployed to my device. When I attempt to execute the line below I receive an error message:

System.Data.SQLite.SQLiteConnection connection= new System.Data.SQLite.SQLiteConnection();

The error is as follows:

System.TypeLoadException was unhandled
  Message="Could not load type 'System.Data.SQLite.SQLiteConnection' from assembly 'System.Data.SQLite, Version=1.0.82.0, Culture=neutral, PublicKeyToken=1FDB50B1B62B4C84'."
  StackTrace:
    at System.Windows.Forms.Control.OnClick()
    at System.Windows.Forms.Button.OnClick()
    at System.Windows.Forms.ButtonBase.WnProc()
    at System.Windows.Forms.Control._InternalWnProc()
    at Microsoft.AGL.Forms.EVL.EnterMainLoop()
    at System.Windows.Forms.Application.Run()
    at ManagedFramework.Windows.Forms.Manager.Run()
    at ManagedFramework.Program.runGUI()
    at ManagedFramework.Program.Main()
  InnerException:


I do have the System.Data.SQLite.dll assembly referenced.

Also, how can I check to if this is being compiled for .NET Compact Framework 2.0 ?

And I've noticed that there's a "System.Transactions" reference in the System.Data.SQLite.Compact.2008 project but the project compiles without error. Should I remove the reference?

Thanks again,
Brian Wheatley

Loading...