Click here to Skip to main content
11,410,536 members (55,028 online)
Click here to Skip to main content

Simple C# Wrapper for SQLite

, 16 Aug 2007
Rate this:
Please Sign up or sign in to vote.
An article that describes lightweight C# wrapper for SQLite


This article describes a very simple wrapper class for SQLite. This class provides only few simple functions: opening and closing database, returning the list of tables and executing queries. Although these are basic functions, they are enough for someone who needs only a storage engine for his/her program.


While writing this class, I've been using ADO.NET Data Provider for SQLite as a reference, which I found here.

Using the Code

Using this class is very easy: add a reference to this DLL (Project->AddReference...) in your project and a line to your code:

using SQLWrapper;

Now you can start using database functions in your program.


// creates a new instance of SQLiteBase and opens database in file "test.db"
SQLiteBase db = new SQLiteBase("test.db");
// executes SELECT query and store results in new data table
DataTable table = db.ExecuteQuery("SELECT * FROM table1 WHERE id = 1;");
// closes the database

Source Code

There are two constructors and and five public functions:

  • OpenDatabase
  • CloseDatabase
  • GetTables
  • ExecuteNonQuery
  • ExecuteQuery

which are all well-documented in the source file, so I don't see a point in explaining them again.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Software Developer (Junior)
Croatia Croatia
No Biography provided

Comments and Discussions

QuestionUpdates for .NET 4.5.1 ? Pinmemberkiquenet.com31-Jan-14 5:06 
QuestionProblem Pinmemberdaghune19-Oct-13 1:29 
GeneralThanks Pinmembernikzorom9-Jan-13 11:32 
QuestionOpen database with password Pinmembermoez.hielmy27-Aug-12 18:06 
GeneralEtrow Exception PinmemberAl Baikr16-Jul-10 22:30 
Rant[My vote of 2] Not reacting to malformed queries PinmemberRobhol5-Jul-10 13:44 
GeneralUpdate for Net 4.0 [modified] Pinmemberanss1236-Jun-10 22:04 
GeneralRe: Update for Net 4.0 Pinmemberupsfeup7-Jul-10 5:24 
GeneralRe: Update for Net 4.0 Pinmemberanss12327-Aug-10 4:59 
GeneralHaving Error: library routine called out of sequence Pinmemberupsfeup26-May-10 3:44 
GeneralRe: Having Error: library routine called out of sequence Pinmemberanss1234-Jun-10 4:02 
GeneralMy Sincerest THANKS!! Pinmemberkidzopa15-May-10 17:12 
GeneralA possible alternative; NFileStorage Pinmembersnip117-Mar-09 7:54 
Generalcreate a database PinmemberChaozzster16-Feb-09 7:28 
GeneralRe: create a database Pinmemberthk_sompi1-Mar-09 13:16 
GeneralRe: create a database PinmemberKen Eucker3-Jun-09 10:25 
GeneralRe: create a database Pinmemberfbelic4-Jun-09 0:14 
GeneralRe: create a database PinmemberKen Eucker4-Jun-09 22:19 
Generalout of memory Pinmembersaifsail24-Jan-09 9:32 
GeneralPossible memory leak PinmemberJacky__E24-Nov-08 4:34 
GeneralRe: Possible memory leak [modified] Pinmemberoren.shnitzer22-Dec-08 11:21 
GeneralRe: Possible memory leak PinmemberJacky__E23-Dec-08 4:16 
GeneralNo more memory leak PinmemberSten Hjelmqvist23-Sep-09 3:19 
GeneralRe: Possible memory leak Pinmemberkidzopa15-May-10 17:28 
GeneralSame Error PinmemberMember 331205521-Sep-08 9:50 
GeneralRe: Same Error PinmemberMember 331205521-Sep-08 10:21 
Generalfacing some bug with your dll Pinmemberchal_adiera27-Aug-08 23:42 
QuestionCan I use it in my Media Player? PinmemberSukhjinder_K4-Jan-08 1:58 
GeneralVery Nice & Easy to Use PinmemberSukhjinder_K15-Nov-07 22:22 
AnswerRe: Very Nice & Easy to Use PinmemberJacky__E23-Dec-08 4:18 
GeneralThanks for this class Pinmemberflangset29-Aug-07 1:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150414.5 | Last Updated 16 Aug 2007
Article Copyright 2007 by fbelic
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid