SQLite WinRT empowers Windows and Windows Phone developers to build mobile enterprise apps using Windows Runtime (WinRT) APIs to work with the world’s most popular mobile database.
SQLite advantages include cross-platform (OS + Processor) support, speed, ACID reliability, and support for indexes, views, foreign keys, and triggers. Developers of SQLite apps on iPhones, iPads and Android devices will feel right at home programming against the SQLite WinRT APIs since they provide just a thin layer around familiar SQLite functions.
To get started with the installation, you need to get the SQLite Extension SDK downloaded and working with Visual Studio. From within Visual Studio, go to the menu and select Tools | Extensions and Updates. From the dialog that appears, expand the Online tree view node on the left and then type SQLite in the search box on the right and hit enter. You’ll be shown a list of search results as shown in the figure below:
Click Download for both SQLite for Windows Runtime and SQLite for Windows Phone so you’ll be ready to develop across all platforms. The VSIX Installer dialog will pop up during both downloads and you’ll need to click Install for each. Click the Restart Now button at the bottom of the dialog so that the changes will take effect. This gets the SQLite3.dll native library installed and Visual Studio will notify you whenever future updates are available. Keep in mind that future versions will prevent your existing Visual Studio projects from opening due to file path changes because of new version numbers. You simply need to update the reference in your project file each time you choose to work with newer versions of SQLite.
The next step in the installation process is to download the SQLite WinRT source code from http://sqlwinrt.codeplex.com/. On the CodePlex site, click the Source Code tab, and then click the Download icon to download the zip file. When you extract the zip file, you’ll see a Visual Studio solution with a project for Windows and another project for Windows Phone.
Create a new Windows Phone App project in Visual Studio and target Windows Phone 8.0. Once the empty project has opened, go to the Solution Explorer and right click on the Solution then select Add | Existing Project. When the file dialog pops up, navigate to the SQLiteWinRTPhone folder within the extracted files you downloaded and select SQLiteWinRTPhone.vcxproj to add the project to your solution. From the Phone solution, right click on References and select Add Reference. In the Reference Manager dialog, expand the Solution node on the left to show Projects. Check the checkbox for SQLiteWinRTPhone and click OK. Save and rebuild the solution to ensure everything installed properly and then you’re ready to go.
Create a new Windows Store App project in Visual Studio. Once the empty project has opened, go to the Solution Explorer and right click on the Solution then select Add | Existing Project. When the file dialog pops up, navigate to the SQLiteWinRT folder within the extracted files you downloaded and select SQLiteWinRT.vcxproj to add the project to your solution. From the Windows Store solution, right click on References and select Add Reference. In the Reference Manager dialog, expand the Solution node on the left to show Projects. Check the checkbox for SQLiteWinRT and click OK. Save and rebuild the solution to ensure everything installed properly and you’re all set.
With the installation steps complete, you’re now ready to begin developing apps for Windows Phones, Tablets, Laptops, and Desktops. In my next SQLite article I’ll get you started with basic Data Definition Language (DDL) tasks.