<p>I've done this before in C++ by including sqlite.h but is there a similarly easy way in C#?</p>

[{'answer_id': 26027, 'author': 'robintw', 'author_id': 1912, 'author_profile': 'https://Stackoverflow.com/users/1912', 'pm_score': 3, 'selected': False, 'text': '<p>There is a list of Sqlite wrappers for .Net at <a href="http://www.sqlite.org/cvstrac/wiki?p=SqliteWrappers" rel="noreferrer">http://www.sqlite.org/cvstrac/wiki?p=SqliteWrappers</a>. From what I\'ve heard <a href="http://sqlite.phxsoftware.com/" rel="noreferrer">http://sqlite.phxsoftware.com/</a> is quite good. This particular one lets you access Sqlite through ADO.Net just like any other database.</p>\n'}, {'answer_id': 26035, 'author': 'Espo', 'author_id': 2257, 'author_profile': 'https://Stackoverflow.com/users/2257', 'pm_score': 7, 'selected': True, 'text': '<p><a href="https://www.nuget.org/packages/Microsoft.Data.Sqlite" rel="nofollow noreferrer">Microsoft.Data.Sqlite</a> by Microsoft has over 9000 downloads every day, so I think you are safe using that one.</p>\n<p>Example usage from <a href="https://learn.microsoft.com/dotnet/standard/data/sqlite/" rel="nofollow noreferrer">the documentation</a>:</p>\n<pre><code>using (var connection = new SqliteConnection(&quot;Data Source=hello.db&quot;))\n{\n    connection.Open();\n\n    var command = connection.CreateCommand();\n    command.CommandText =\n    @&quot;\n        SELECT name\n        FROM user\n        WHERE id = $id\n    &quot;;\n    command.Parameters.AddWithValue(&quot;$id&quot;, id);\n\n    using (var reader = command.ExecuteReader())\n    {\n        while (reader.Read())\n        {\n            var name = reader.GetString(0);\n\n            Console.WriteLine($&quot;Hello, {name}!&quot;);\n        }\n    }\n}\n</code></pre>\n'}, {'answer_id': 30746, 'author': 'bvanderw', 'author_id': 3298, 'author_profile': 'https://Stackoverflow.com/users/3298', 'pm_score': 4, 'selected': False, 'text': '<p>I\'ve used this with great success:</p>\n\n<p><a href="http://system.data.sqlite.org/" rel="nofollow noreferrer">http://system.data.sqlite.org/</a></p>\n\n<p>Free with no restrictions.</p>\n\n<p>(Note from review: Original site no longer exists.  The above link has a link pointing the the 404 site and has all the info of the original)</p>\n\n<p>--Bruce</p>\n'}, {'answer_id': 1245352, 'author': 'xanadont', 'author_id': 1886, 'author_profile': 'https://Stackoverflow.com/users/1886', 'pm_score': 3, 'selected': False, 'text': '<p>There\'s also now this option: <a href="http://code.google.com/p/csharp-sqlite/" rel="noreferrer">http://code.google.com/p/csharp-sqlite/</a> - a complete port of SQLite to C#.</p>\n'}, {'answer_id': 1253002, 'author': 'DA.', 'author_id': 153494, 'author_profile': 'https://Stackoverflow.com/users/153494', 'pm_score': 6, 'selected': False, 'text': '<p>I\'m with, Bruce.  I AM using <a href="http://system.data.sqlite.org/" rel="noreferrer">http://system.data.sqlite.org/</a> with great success as well.  Here\'s a simple class example that I created:</p>\n\n<pre><code>using System;\nusing System.Text;\nusing System.Data;\nusing System.Data.SQLite;\n\nnamespace MySqlLite\n{\n      class DataClass\n      {\n        private SQLiteConnection sqlite;\n\n        public DataClass()\n        {\n              //This part killed me in the beginning.  I was specifying "DataSource"\n              //instead of "Data Source"\n              sqlite = new SQLiteConnection("Data Source=/path/to/file.db");\n\n        }\n\n        public DataTable selectQuery(string query)\n        {\n              SQLiteDataAdapter ad;\n              DataTable dt = new DataTable();\n\n              try\n              {\n                    SQLiteCommand cmd;\n                    sqlite.Open();  //Initiate connection to the db\n                    cmd = sqlite.CreateCommand();\n                    cmd.CommandText = query;  //set the passed query\n                    ad = new SQLiteDataAdapter(cmd);\n                    ad.Fill(dt); //fill the datasource\n              }\n              catch(SQLiteException ex)\n              {\n                    //Add your exception code here.\n              }\n              sqlite.Close();\n              return dt;\n  }\n}\n</code></pre>\n\n<p>There is also an <a href="https://www.nuget.org/packages/System.Data.SQLite" rel="noreferrer">NuGet package: System.Data.SQLite</a> available.</p>\n'}, {'answer_id': 11659702, 'author': 'lmat - Reinstate Monica', 'author_id': 200985, 'author_profile': 'https://Stackoverflow.com/users/200985', 'pm_score': 1, 'selected': False, 'text': '<p>Mono comes with a wrapper, use theirs!</p>\n\n<p><a href="https://github.com/mono/mono/tree/master/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0" rel="nofollow">https://github.com/mono/mono/tree/master/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0</a> gives code to wrap the actual SQLite dll ( <a href="http://www.sqlite.org/sqlite-shell-win32-x86-3071300.zip" rel="nofollow">http://www.sqlite.org/sqlite-shell-win32-x86-3071300.zip</a> found on the download page <a href="http://www.sqlite.org/download.html/" rel="nofollow">http://www.sqlite.org/download.html/</a> ) in a .net friendly way. It works on Linux or Windows.</p>\n\n<p>This seems the thinnest of all worlds, minimizing your dependence on third party libraries. If I had to do this project from scratch, this is the way I would do it.</p>\n'}, {'answer_id': 12185363, 'author': 'Bronek', 'author_id': 769465, 'author_profile': 'https://Stackoverflow.com/users/769465', 'pm_score': 2, 'selected': False, 'text': '<p>Another way of using SQLite database in NET Framework is to use <strong>Fluent-NHibernate</strong>.<br/>\n[It is NET module which wraps around NHibernate (ORM module - Object Relational Mapping) and allows to configure NHibernate programmatically (without XML files) with the fluent pattern.]</p>\n\n<p>Here is the brief \'Getting started\' description how to do this in C# step by step:</p>\n\n<p><a href="https://github.com/jagregory/fluent-nhibernate/wiki/Getting-started" rel="nofollow">https://github.com/jagregory/fluent-nhibernate/wiki/Getting-started</a></p>\n\n<p>It includes a source code as an Visual Studio project.</p>\n'}, {'answer_id': 17215998, 'author': 'xanadont', 'author_id': 1886, 'author_profile': 'https://Stackoverflow.com/users/1886', 'pm_score': 3, 'selected': False, 'text': '<p><a href="https://github.com/praeclarum/sqlite-net" rel="noreferrer">https://github.com/praeclarum/sqlite-net</a> is now probably the best option.</p>\n'}, {'answer_id': 64220839, 'author': 'floyd70s', 'author_id': 12537320, 'author_profile': 'https://Stackoverflow.com/users/12537320', 'pm_score': 0, 'selected': False, 'text': '<p>if you have any problem with the library you can use <code>Microsoft.Data.Sqlite;</code></p>\n<pre><code> public static DataTable GetData(string connectionString, string query)\n        {\n            DataTable dt = new DataTable();\n            Microsoft.Data.Sqlite.SqliteConnection connection;\n            Microsoft.Data.Sqlite.SqliteCommand command;\n\n            connection = new Microsoft.Data.Sqlite.SqliteConnection(&quot;Data Source= YOU_PATH_BD.sqlite&quot;);\n            try\n            {\n                connection.Open();\n                command = new Microsoft.Data.Sqlite.SqliteCommand(query, connection);\n                dt.Load(command.ExecuteReader());\n                connection.Close();\n            }\n            catch\n            {\n            }\n\n            return dt;\n        }\n</code></pre>\n<p>you can add NuGet Package Microsoft.Data.Sqlite</p>\n'}, {'answer_id': 65482510, 'author': 'ali asghar tofighian', 'author_id': 6078802, 'author_profile': 'https://Stackoverflow.com/users/6078802', 'pm_score': 1, 'selected': False, 'text': '<p>Here I am trying to help you do the job step by step: (this may be the answer to other questions)</p>\n<ol>\n<li>Go to <a href="https://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki" rel="nofollow noreferrer">this address</a> , down the page you can see something like &quot;<strong>List of Release Packages</strong>&quot;. Based on your system and .net framework version choose the right one for you. for example if your want to use .NET Framework 4.6 on a 64-bit Windows, choose <a href="https://system.data.sqlite.org/downloads/1.0.113.0/sqlite-netFx46-setup-x64-2015-1.0.113.0.exe" rel="nofollow noreferrer">this version</a> and download it.</li>\n<li>Then install the file somewhere on your hard drive, just like any other software.</li>\n<li>Open Visual studio and your project. Then in solution explorer, right-click on &quot;<strong>References</strong>&quot; and choose &quot;<strong>add Reference...</strong>&quot;.</li>\n<li>Click the browse button and choose where you install the previous file and go to .../bin/System.Data.SQLite.dll and click add and then OK buttons.</li>\n</ol>\n<p>that is pretty much it. now you can use SQLite in your project.\nto use it in your project on the code level you may use this below example code:</p>\n<ol>\n<li><p>make a connection string:</p>\n<p><code>string connectionString = @&quot;URI=file:{the location of your sqlite database}&quot;;</code></p>\n</li>\n<li><p>establish a sqlite connection:</p>\n<p><code>SQLiteConnection theConnection = new SQLiteConnection(connectionString );</code></p>\n</li>\n<li><p>open the connection:</p>\n<p><code>theConnection.Open();</code></p>\n</li>\n<li><p>create a sqlite command:</p>\n<p><code>SQLiteCommand cmd = new SQLiteCommand(theConnection);</code></p>\n</li>\n<li><p>Make a command text, or better said your SQLite statement:</p>\n<p><code>cmd.CommandText = &quot;INSERT INTO table_name(col1, col2) VALUES(val1, val2)&quot;;</code></p>\n</li>\n<li><p>Execute the command</p>\n<p><code>cmd.ExecuteNonQuery();</code></p>\n</li>\n</ol>\n<p>that is it.</p>\n'}]
['https://Stackoverflow.com/questions/26020', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2674/']