Using SQLite within Visual Studio

From SwinBrain

Visual Studio includes a number of tools for automating database access code generation, and creating and manipulating database schemas. These tools make the process of working with databases significantly easier and more shiny. To make the most of the SQLite embedded DBMS you will need to install the SQLite .NET provider (which includes a DDEX provider for Visual Studio).

The content of this section was created for Visual Studio 2008 Professional Edition and SQLite 3. This may not be relevant for different versions of this software.


Step 1: Download and Install the ADO.NET Provider

Before you can begin using SQLite within Visual Studio you need to download the SQLite ADO.NET Provider.

Note: Make sure you download a 'SQLite-xxx-setup.exe' file, and NOT a 'xxx-binaries' or 'xxx-sources' .zip file ("SQLite-" for example).

After installing the provider, you will need to restart Visual Studio in-order for it to appear in the data sources list. The set-up will install the .NET provider, and update your registry for you, so once you have competed the set-up you're ready to use SQLite from within Visual Studio

Step 2: Creating a connection to a SQLite database

To actually use SQLite within Visual Studios nice shiny database tools, you need to add a connection to a SQLite database. To do this, ensure the Server Explorer is open (View->Server Explorer, or CTRL+W - if its not), and right-click Data Connections and select Add Connection.

Right-click "Data Connections", and select "Add Connection...".

You will then need to select "SQLite Database File", as your desired data source, and ".NET Framework Data Provider for SQLite" as data provider (which is the default). Select the Data Source and Data Provider for SQLite.

The Add Connection dialog.

After hitting Continue, the Add Connection dialog will display, allowing you to specify the filename (*.sqlite) of the SQLite database you with to connect to, or create. Optionally here you may also specify choices about string and date encoding, as well as database file encryption (in the password field). When done, hit the Test Connection button to ensure the connection is working correctly, and click OK to finish the wizard.

Step 3: Use the connection

Now that you have a connection to a SQLite database using Visual Studio, you can use Visual Studios tools to do things, such as:

Useful Links

SwinBrain Links

External Links