Using SQLite in C# – Building Simple, Powerful, Portable Databases for Your Application


Have you ever wanted to store data for an application but didn’t want to deal with the hassle of a full database server? Or maybe you wanted to have one database per installation. Those and many other scenarios are a perfect fit for SQLite. Today I am going to show you how to get started using SQLite in C#. We will build a small database, attach it to a C# project, and then wire up our project to read from and write to the database.

SQLite From Start to Finish course:
Source Code:
Newsletter signup:


Xem Thêm Bài Viết Khác:


  1. @IAmTimCorey – your example is not valid as of 2/1/2020, if you follow you example using VS 2017 you have issues. It'd be great if you could do an example using SQLite as

  2. Hi Tim, iI read the data from the database and use that data to calculate the main data. Then, I update the calculated data into the database again.

    The problem is that the 'database is locked'. I can't think of a solution.

    If you have good ideas, please tell me.

  3. Hi Tim, what about if I send the program, to a friend, who hasn't installed SQLite? Will it work anyways, I mean, does the compilation process embed a standalone database?

  4. Hi Tim, great tutorial. Thank you for sharing. Please I would like to know how to password protect my sqlite database. Thank you.

  5. I love the simplicity if SQLite, especially with WPF development.

    I’m writing an app now that will allow the user to password protect specific records.

    For the average user, they won’t know how to open the .Db file, but I can’t help but ask, HOW can I encrypt the SQLite database?

    I’ve seen mentioned SQLite Cipher, but is that the best way to go when working w/WPF applications?

    Any suggestions are definitely appreciated!

    I also feel SQLite encryption would make a great follow up video to your other training on SQLite!


  6. Hi Tim, since SQLite doesn't allow you to create stored procedures, are you forced to write SQL inside of your C# code? Or is there a way around this? I'm curious because writing the SQL inside the C# would be a security risk, correct?

  7. Can the WinForms project be create in .net core ?  I'm looking at creating a fully portable App for windows including SQLite.I have broken the app into 3 tiers.  The data layer will be .net core with SQLite and Entity Framework.  Middle layer is business layer which will call DL.  These layers can be written in .net core.  My only impedance is that the GUI will also need to be in .net core.

  8. I was working on a C# MVC .NET Core, web-based application, but this video still helped me a TON. I'd been looking at so many tutorials and videos, but none of them were able to explain as well as show it to the degree that you did. Thank you so much!

  9. I want to include a mysql database in my project exactly as you included your SQLite database . You said we should visit I cant find a good example there .

  10. Tim, I agree the way of teaching is amazing with slow pace and injecting in viewers mind slowly and nicely.
    But at time confusing may be because of the method you took up about SQL connections and accessing.
    In fact I saw better methods in the net without confusion.

    Thanks any way…

  11. Hi Tim, after creating a sqlite in DB Browser, I went to my project and showed all the files but the db did not show up. How can I see the db under my windows application

  12. I am getting this error 'Error parsing column 2 (Description=System.Byte[] – Object)'
    and InvalidCastException: Object must implement IConvertible.

    I just followed your steps 🙁

  13. Hi, First, great video! Second, I'm trying to download dapper (I'm using Visual Studio 2013 Professional) and it fails and says "Could not install package 'Dapper 2.0.4'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
    ", what can I do? and is there a similar library to dapper?

  14. Hi Tim, Thank you for this video. I would like to clarify my doubts on Sqlite DB. I have been working on WPF with SQLite DB , create a setup project for taking build of the application. When I run the application after installing on my local machine, I am facing an issue of "SQLite.Interop.dll" when I am trying to read data from the database. I would also like to know how to retain the Sqlite database even after uninstalling the application on the Windows machine? Please help me and guide me if you have any video relating to it.

    Looking forward to hearing from you. Thanks in advance.

  15. I confess, it seems there's no better explanation across the web. Well done!
    Question: is there a parameter that allows to rewrite a single record each time?


Please enter your comment!
Please enter your name here