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

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ม.ค. 2025

ความคิดเห็น • 792

  • @ManieVerster
    @ManieVerster 9 หลายเดือนก่อน +1

    Hi Tim, you know the saying you cannot teach an old dog new tricks? Well, you busted that one. You taught this old dog a new trick and it's just marvellous. Thanks man!!!!

    • @IAmTimCorey
      @IAmTimCorey  9 หลายเดือนก่อน

      Awesome! I’m glad it was helpful.

  • @gerrycallaghan5519
    @gerrycallaghan5519 5 ปีที่แล้ว +2

    Tim's courses are by far the most clear and concise I've done. Having the code to download to play with is so useful. A great resource.

    • @IAmTimCorey
      @IAmTimCorey  5 ปีที่แล้ว

      I appreciate the kind words.

  • @MichaelMyersDoverPA
    @MichaelMyersDoverPA 3 ปีที่แล้ว +4

    Thank you for a great, direct and useful tutorial for SQLite in C#. I am new to SQLite and this video was a real example of a quality presentation with real-world scenarios of using C# with a file-based database system in a contained environment. Well done, sir.

  • @acidhauss7018
    @acidhauss7018 6 ปีที่แล้ว +9

    By far and away the best C# material on youtube, thanks for all your help.

    • @IAmTimCorey
      @IAmTimCorey  6 ปีที่แล้ว

      You are most welcome. Thanks for watching.

  • @afterbunny257
    @afterbunny257 4 ปีที่แล้ว +7

    17:26 Relative connection string
    19:11 - 21:50 Dependent packages
    26:00 Get connection string in library project
    29:47 Query list of PersonModel from db
    31:50 Write a person to db

    • @IAmTimCorey
      @IAmTimCorey  4 ปีที่แล้ว +2

      I added it to the description. Thanks so much.

    • @afterbunny257
      @afterbunny257 4 ปีที่แล้ว

      @@IAmTimCorey Can you set up a pay method for AliPay? I believe there are many Chinese subscriber like me who what to enroll your course. Most chinese don't use credit cards.

    • @IAmTimCorey
      @IAmTimCorey  4 ปีที่แล้ว

      Unfortunately, I don't have the ability to do that. Teachable (my host) only provides Stripe and PayPal.

  • @djchaseful
    @djchaseful 3 ปีที่แล้ว +3

    Tim Corey, Thanks! I can't express how much I have learned from your videos.

    • @IAmTimCorey
      @IAmTimCorey  3 ปีที่แล้ว

      I’m glad my content has been so helpful.

  • @maciejk125
    @maciejk125 5 ปีที่แล้ว +1

    I had to learn a bit of java lately, forcing me to watch some different tutorials, and let me say this, you have achieved your goal. You do make learning c# easier.

    • @IAmTimCorey
      @IAmTimCorey  5 ปีที่แล้ว

      I appreciate the kind words.

  • @tanu3873
    @tanu3873 6 ปีที่แล้ว +2

    Great video! I'm happy you're back!

    • @IAmTimCorey
      @IAmTimCorey  6 ปีที่แล้ว

      Thanks. I'm happy to be back.

  • @RalfsBalodis
    @RalfsBalodis 4 ปีที่แล้ว +8

    0:00 - Intro
    1:14 - Demo app overview (win form app)
    4:30 - What is SQLite
    5:09 - How to create and build SQLite Database: DB Browser for SQLite
    11:17 - Database Structure
    13:04 - Adding the Database to the project
    15:26 - Adding the Connection string
    18:15 - SQLite and Dapper NUGet packages
    21:58 - Data access setup
    28:17 - Retrieving data form DB: LoadPeople()
    30:14 - Sending data to DB: SavePerson()
    31:51 - Wiring up the Demo app
    33:08 - Workings with the Database
    36:18 - Summary and concluding remarks

    • @IAmTimCorey
      @IAmTimCorey  4 ปีที่แล้ว +1

      Great job, thanks again

  • @katerose6161
    @katerose6161 4 ปีที่แล้ว +2

    Love you, Tim!!! I cannot describe how happy I am to find this tutorial :DDD Thank you endlessly !

    • @IAmTimCorey
      @IAmTimCorey  4 ปีที่แล้ว +1

      Be sure to check out the whole channel - th-cam.com/channels/-ptWR16ITQyYOglXyQmpzw.html. Use the search icon under the Subscribe button to search within the channel to find the training you need next.

  • @MikePageDev
    @MikePageDev 6 ปีที่แล้ว +1

    This is the video I have been waiting for. Thanks Tim. I have a number of projects I get me teeth in to now.

    • @IAmTimCorey
      @IAmTimCorey  6 ปีที่แล้ว

      Excellent!

    • @MikePageDev
      @MikePageDev 6 ปีที่แล้ว

      Just need to decide witch one to start with lol

  • @janne_kekalainen
    @janne_kekalainen 6 ปีที่แล้ว +2

    Your channel is a gold mine. Super awesome content.

    • @IAmTimCorey
      @IAmTimCorey  6 ปีที่แล้ว +1

      I appreciate the kind words.

  • @ZajoSTi
    @ZajoSTi 6 ปีที่แล้ว +1

    Glad to see you have pulled through. And thank you for another great video.

  • @samjaouhar7246
    @samjaouhar7246 4 ปีที่แล้ว +1

    thanks, Tim for all the videos and effort your providing. you are a legend, you are the best teacher ever. definitely, I will have a course with you one day.

  • @manukartofanu
    @manukartofanu 3 ปีที่แล้ว +3

    Thank you for a great introduction to SQLite!

    • @IAmTimCorey
      @IAmTimCorey  3 ปีที่แล้ว

      You're very welcome!

  • @nopelganger
    @nopelganger 5 ปีที่แล้ว +1

    This is an incredible tutorial, even if it just covering the very basics.
    i gotta admit, in itself SQLite is quite a powerful tool.
    Thanks a lot, Tim!

    • @IAmTimCorey
      @IAmTimCorey  5 ปีที่แล้ว

      You are most welcome. Thanks for watching.

  • @hansbyager5795
    @hansbyager5795 3 ปีที่แล้ว +1

    i love the intro, iit explains EXACTLY what I am looking for, so in watching this, I went, yes... yees.. YES!!!

  • @anshul1212
    @anshul1212 ปีที่แล้ว +1

    Boss ...you are just brilliant ......wooww...every topic explained very clearly.....u know what is missing in daily soap and u just bang on fish eye.....

  • @GiorgiBekurashvili
    @GiorgiBekurashvili 11 หลายเดือนก่อน +1

    Your tutorials are so clear and straight to the point! ❤

    • @IAmTimCorey
      @IAmTimCorey  11 หลายเดือนก่อน

      I am glad they are helpful.

  • @kopilkaiser8991
    @kopilkaiser8991 ปีที่แล้ว +1

    It is a very good tutorial to learn to connect a database for quick use for your application

    • @IAmTimCorey
      @IAmTimCorey  ปีที่แล้ว

      I am glad it was helpful.

  • @mohamedazzouz6086
    @mohamedazzouz6086 10 หลายเดือนก่อน +1

    Hello Corey, Thank you for the excellent tutorial

    • @IAmTimCorey
      @IAmTimCorey  10 หลายเดือนก่อน +1

      You are welcome.

  • @UnknownMoses
    @UnknownMoses 9 หลายเดือนก่อน +2

    I know this is sort of outside the scope but, If you want to distribute your application with some tables containing data, I prefer using EmbeddedResource as the compile action and using that to create the db file if it doesn't exist at the specified path. This allows you control when the database file is copied/written. I feel like this offers more control over the database file on deployment when users execute the program. You can offer the user features such and restarting from scratch you can disconnect from the database, delete the db file and replace it with the embedded resource version of the database. Like for example if the database somehow got corrupted.

    • @IAmTimCorey
      @IAmTimCorey  9 หลายเดือนก่อน

      Thanks for sharing!

  • @alcidesneto6415
    @alcidesneto6415 4 ปีที่แล้ว +1

    I am going to use this tutorial in some personal tools! Thanks a lot, Tim!

  • @khandakarrashedhassan8193
    @khandakarrashedhassan8193 4 ปีที่แล้ว +2

    I just needed this. Thanks for the video. There are a lot of resources out there but they are just messy.

    • @IAmTimCorey
      @IAmTimCorey  4 ปีที่แล้ว

      Glad it was helpful!

  • @harag9
    @harag9 6 ปีที่แล้ว

    Nice tutorial Tim, looking forward to the full course.

  • @michabarbarski7362
    @michabarbarski7362 ปีที่แล้ว +2

    Thank you for the excellent guide, you are a great teacher

  • @ehsandaneshvar
    @ehsandaneshvar หลายเดือนก่อน

    Perfect / Simple and Useful even for experts

  • @heinrichwurstwatten7553
    @heinrichwurstwatten7553 6 ปีที่แล้ว

    YES, I have been waiting for this!

  • @fbaez51
    @fbaez51 5 ปีที่แล้ว +2

    Tim Corey is my .net god!

  • @ordishysa
    @ordishysa 6 ปีที่แล้ว

    A very comprehensive method Tim

  • @n9434178
    @n9434178 6 ปีที่แล้ว

    Great video - looking forward to doing the full course

  • @Jfarro
    @Jfarro 3 ปีที่แล้ว

    Tim - "Its not too much to ask a person to give me a first and last name". Maddona- "Am I a Joke to you?! Do I not get to play in your database?" :P J/k, this is amazing and I'm subscribing just because of how well laid out this is. I needed something to explain c# and sql lite but didn't want a 3 hour course, and I needed some basics on the sql lite part as well. You did a great job with this!

    • @IAmTimCorey
      @IAmTimCorey  3 ปีที่แล้ว +1

      I'm glad it was helpful. And yes, people will always have an exception to the rule, which makes creating any type of validation hard.

  • @nishan375
    @nishan375 4 ปีที่แล้ว

    Thanks. I am definitely buying your start to finish course.

  • @grampygamer8584
    @grampygamer8584 5 ปีที่แล้ว +1

    Superb tutorial yet again! you never fail buddy :)

  • @vanttildet3069
    @vanttildet3069 3 ปีที่แล้ว +1

    Thanks for the great course and general sharing knowledge

  • @ptsg
    @ptsg 5 ปีที่แล้ว

    Extremely clear explanation, great job!

  • @markcediegabinete2647
    @markcediegabinete2647 5 ปีที่แล้ว +1

    Thanks for this tutorial Tim

  • @ghostcode829
    @ghostcode829 6 ปีที่แล้ว +1

    Thank you so much for this! You're an absolute lifesaver!

    • @IAmTimCorey
      @IAmTimCorey  6 ปีที่แล้ว

      You are most welcome. Thanks for watching.

  • @ivandrofly
    @ivandrofly 5 ปีที่แล้ว +2

    I like the video before watching 😊😊

    • @IAmTimCorey
      @IAmTimCorey  5 ปีที่แล้ว +1

      I am glad you have such faith in me.

  • @deborahconde4634
    @deborahconde4634 4 ปีที่แล้ว +2

    Tim Corey you saved my ass, love you

  • @sc0tty319
    @sc0tty319 4 ปีที่แล้ว +1

    great tutorial!
    샘 짱이에요 :) 쉽게 잘 가르쳐주시네요 from s.korea

  • @vanishdoma2675
    @vanishdoma2675 ปีที่แล้ว +1

    Thank you. it is what i was looking for!

  • @HopInTheCloud
    @HopInTheCloud 4 ปีที่แล้ว

    Very good video. Exactly what I was looking for and the video already answered a lot of my questions.

    • @IAmTimCorey
      @IAmTimCorey  4 ปีที่แล้ว

      Glad it was helpful!

  • @ИльяМанишин
    @ИльяМанишин 2 ปีที่แล้ว

    Waw, this is the best explaining. It's incredible

  • @jiminaaa1993
    @jiminaaa1993 5 ปีที่แล้ว +1

    Thank you so much sir.... Nice and easy tutorial.

  • @ajvenable7937
    @ajvenable7937 4 ปีที่แล้ว

    Thanks for the video Tim

  • @fouadchelfi2590
    @fouadchelfi2590 2 ปีที่แล้ว +1

    Thank you very much! very useful course.

  • @sooryaprakash8984
    @sooryaprakash8984 5 ปีที่แล้ว

    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...

    • @IAmTimCorey
      @IAmTimCorey  5 ปีที่แล้ว

      Well, if you know an easier way of doing it for you, that's great!

    • @sooryaprakash8984
      @sooryaprakash8984 5 ปีที่แล้ว

      Pls. don't mind Tim.
      Again and again I say your way of teaching is ultimate. That was the only video confusing a bit, rest all the best.

  • @DanFlakes
    @DanFlakes 3 ปีที่แล้ว

    Thanks for informative video, Tim!

  • @nsreality2781
    @nsreality2781 5 ปีที่แล้ว

    super work Tim Corey

  • @StudentCompanion
    @StudentCompanion 3 ปีที่แล้ว +1

    Great video. Thanks.
    Just to clear my understanding, SQLite is just meant for 1 user, you can't point 2 or more machines to the same SQLite database so they have same data like in full sql.

    • @IAmTimCorey
      @IAmTimCorey  3 ปีที่แล้ว +2

      You technically can, but SQLite was designed for one user. Having multiple use it will increase the likelihood of collisions.

    • @StudentCompanion
      @StudentCompanion 3 ปีที่แล้ว +2

      @@IAmTimCorey Thanks.

    • @nilsfrahm1323
      @nilsfrahm1323 3 ปีที่แล้ว

      I think with sqlite you may even be limited on how many connections you can open to db. It is limited to single user.

  • @MrCensorMe
    @MrCensorMe 4 ปีที่แล้ว

    Thanks a lot for the video and explanation man, was easy to understand and extremely helpful.

    • @IAmTimCorey
      @IAmTimCorey  4 ปีที่แล้ว

      You are most welcome. Thanks for watching.

  • @captainslowmtb7409
    @captainslowmtb7409 4 ปีที่แล้ว +1

    Thank you so much for this video Tim, I've been looking for a basic video like this for a good few days, the whole SQL localdb vs SQL Express vs SQLite was just far too confusing when I knew SQLite was what I needed, I just couldn't find a video to show a simple connection (ignore me (apart from the thanks bit) as these might just be words from a rambling programming student).

    • @IAmTimCorey
      @IAmTimCorey  4 ปีที่แล้ว +1

      Glad it was helpful!

  • @Malikz29
    @Malikz29 6 ปีที่แล้ว +1

    Thanks for the useful videos.. One useful suggestion is please zoom to the text in focus to reduce strain in eyes especially for mobile phone user

    • @IAmTimCorey
      @IAmTimCorey  6 ปีที่แล้ว +1

      I do what I can but trying to scale it for mobile is almost impossible.

  • @djmj12714
    @djmj12714 2 ปีที่แล้ว +1

    Thank you so much for posting this! New subscriber here!!

  • @glendamabasa6423
    @glendamabasa6423 3 ปีที่แล้ว

    You AMAZING Tim. Thank you

  • @balthaaa
    @balthaaa 4 ปีที่แล้ว

    Great video tutorial! Thanks for that!

  • @gerrycallaghan5519
    @gerrycallaghan5519 6 ปีที่แล้ว

    Excellent video. Thank you

    • @IAmTimCorey
      @IAmTimCorey  6 ปีที่แล้ว

      You are most welcome. Thanks for watching.

  •  6 ปีที่แล้ว

    Thank you very much Tim!

  • @rbfreitas
    @rbfreitas 3 ปีที่แล้ว

    Thanks a lot for this video. Quite explanatory!!!

    • @IAmTimCorey
      @IAmTimCorey  3 ปีที่แล้ว

      Glad it was helpful!

  • @sayna3
    @sayna3 2 ปีที่แล้ว

    This helped me a lot, thank you

  • @belmiris1371
    @belmiris1371 5 ปีที่แล้ว +1

    Thank you for the video! Just FYI, in WinForms you would want to use a Binding List, not an observable collection.

  • @robsonkinoshita6342
    @robsonkinoshita6342 4 ปีที่แล้ว

    Thanks man! Helped me alot.

  • @josbexerr5166
    @josbexerr5166 6 ปีที่แล้ว

    Gracias excelente Mister Tim.....

  • @VANTYCSolutions
    @VANTYCSolutions 4 ปีที่แล้ว

    Super video thanks!

  • @younessesoft
    @younessesoft 6 ปีที่แล้ว +1

    good job beautiful video very easy to understand useful for beginner helpful for manipulate project include sqlite data for mono pc i like your job continue

  • @divinecho5678
    @divinecho5678 6 ปีที่แล้ว

    Thanks for the video, it was powerful

  • @patrickdavis102
    @patrickdavis102 4 ปีที่แล้ว

    @IAmTimCorey: Fantastic tutorial! I've worked with SQLite on a mobile app via xamarin forms, but the process was VERY different. Thanks!

  • @luismendez9436
    @luismendez9436 4 ปีที่แล้ว +1

    great video.

  • @zunaidhossain872
    @zunaidhossain872 3 ปีที่แล้ว

    Great, Thank you so much.

  • @summerbreeze25syria
    @summerbreeze25syria 4 ปีที่แล้ว

    Thank you for the video.

    • @IAmTimCorey
      @IAmTimCorey  4 ปีที่แล้ว

      You are welcome.

    • @fredericklowe568
      @fredericklowe568 4 ปีที่แล้ว

      Great video. But I have a problem with sqllite. It does not handle storage to well. What I mean is that once a data is deleted. It does not use that space again. So the database can get bloated with empty space.

  • @melchiorvrolijk4907
    @melchiorvrolijk4907 6 ปีที่แล้ว

    By far the best SQLite in C# example video I saw. The only problem I'm having now is in visual studio it runs fine (debug and release mode), but when I publish it I'm getting an 'unable to load dll 'sqlite.interop.dll'' error.

    • @IAmTimCorey
      @IAmTimCorey  6 ปีที่แล้ว

      When you publish, make sure the SQLite interop dlls are going too. I believe they are in a sub-folder under Debug or Release and there are separate DLLs for 32- vs 64-bit.

    • @davidbrewster9743
      @davidbrewster9743 5 ปีที่แล้ว

      @@IAmTimCorey I think this is my problem too. How do you "make sure" they are included in the publish?

  • @thejourney4609
    @thejourney4609 4 ปีที่แล้ว +2

    In .Net Core 3.1 using Visual Studio 2019 Community Edition, you have to download a Nuget Package Called System.Configuration.ConfigurationManager in order to read the app.Config. See video clip at 24:53.

    • @IAmTimCorey
      @IAmTimCorey  4 ปีที่แล้ว

      Yep, I was using the .NET Framework in this video. Thanks for sharing how to do it in .NET Core 3.1.

    • @thejourney4609
      @thejourney4609 4 ปีที่แล้ว

      @@IAmTimCorey Thanks Tim for the video. Your samples are really amazing. My app is 100x better now incorporating your sample!

    • @the_noise_principle
      @the_noise_principle 4 ปีที่แล้ว

      That was the just info I needed. Thank you!

  • @campndad
    @campndad 3 หลายเดือนก่อน

    Thank you for this

    • @IAmTimCorey
      @IAmTimCorey  3 หลายเดือนก่อน

      You are welcome.

  • @alexn4217
    @alexn4217 3 ปีที่แล้ว

    Great course, Tim. I am a new subscriber and I have been learning more from your tutorials than I have on other learning platforms. I encountered an interesting issue with Dapper while coding your demo. It turns out that Dapper isn't a big fan of interfaces so when I tried to be "smart" and created a list of IPersonModel objects, the insert failed. I had to switch my type back to the actual type.

    • @IAmTimCorey
      @IAmTimCorey  3 ปีที่แล้ว +1

      Yep, because Dapper is going to use an actual type to do work. It cannot take an interface because it doesn't know which type to use to do the actual work.

  • @DamagedDingo
    @DamagedDingo 5 ปีที่แล้ว +3

    @iamtimcorey any chance of a WPF example? I can't work out where the connections strings etc go.

    • @IAmTimCorey
      @IAmTimCorey  5 ปีที่แล้ว

      They go in the same place. WPF projects have an app.config file too. If you are referring to WPF Core projects, you would put the connection string in the appsettings.json file (examples of using connection strings with both of these types and more are in the TimCo Retail Manager series).

    • @janne_kekalainen
      @janne_kekalainen 5 ปีที่แล้ว

      I was just thinking the same thing with .NET Core and figured it out with a bit of googling.
      This works:
      1. Add "System.Configuration.ConfigurationManager" NuGet-package (instead of reference)
      - Major change
      2. Create App.config with the connection string inside configuration (like in the video, but doesn't have any of the other groups) then set the file to "content" and "copy to output" (like the database file).
      - Has to be created manually.
      3. Rest works like in the video.

  • @signo18
    @signo18 3 ปีที่แล้ว +4

    How can I use triggers in Sqlite and c#? Is that possible? I don't think so, because sqlite doesn’t work with stored procedured. How do I send values to my triggers without stored procedured?

    • @stanscocom
      @stanscocom 3 ปีที่แล้ว

      Unfortunately, you cannot use Stored Procedures in SQLite. You don't send parameters to a Trigger. You automatically have access to inserted, updated and deleted rows when you're writing the trigger code..

    • @signo18
      @signo18 3 ปีที่แล้ว

      @@stanscocom so i can't send dinamics values for the triggers?

    • @stanscocom
      @stanscocom 3 ปีที่แล้ว +1

      ​@@signo18 No - Triggers are not really triggered by your code. They are triggered by the database when table data is changed. So, even in the SQLite Browser (where you can edit the data in the database), if you change the value of a column that has a trigger on it, the database will automatically execute the trigger immediately.

    • @nilsfrahm1323
      @nilsfrahm1323 3 ปีที่แล้ว

      You could make an extra table for parameters, e.g. TrgParams, and in your table add a column called TrgParamID. Insert parameter in TrgParam table, get its id, and when updating your real table, also set value of TrgParamId column to the new id, e.g. 10. The trigger should fetch the id from the new record, search for the parameter in the TrgParams table, then work based on that.

  • @mrspacer1
    @mrspacer1 6 ปีที่แล้ว +4

    Please, make video about dependency injection

    • @IAmTimCorey
      @IAmTimCorey  6 ปีที่แล้ว +1

      It is coming.

    • @mrspacer1
      @mrspacer1 6 ปีที่แล้ว

      cooool! you are the best

  • @drneshi
    @drneshi 6 ปีที่แล้ว

    I love your tutorials, really easy to understand and follow. At the moment i'm struggling with creating and printing custom documents in c# (reports, receipts) . I tried RDLC but it feels kind of clunky . That would my suggestion for a future video.

    • @IAmTimCorey
      @IAmTimCorey  6 ปีที่แล้ว

      Thanks for the suggestion.

  • @TimeToGG
    @TimeToGG 6 ปีที่แล้ว +2

    very good.

  • @hararr1980
    @hararr1980 6 ปีที่แล้ว

    You are the best ! ;D

  • @williambell4591
    @williambell4591 5 ปีที่แล้ว +1

    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!
    Thanks!

    • @IAmTimCorey
      @IAmTimCorey  5 ปีที่แล้ว

      It is just password protection (which is probably all you need) but have you tried this: stackoverflow.com/a/17855620/733798

  • @josbexerr5166
    @josbexerr5166 5 ปีที่แล้ว

    Gracias Mister Tim

  • @trustingod0
    @trustingod0 ปีที่แล้ว +1

    Hello Tim Corey. I was wondering if you could please explain why the Database file that we created and saved to the WinFormUI project folder is not written to, but instead another Db file is created in the WinFormUI\bin\Debug directory that is written to? Also, if you have a link to some literature that explains why the Db in the Debug directory is used that would be helpful too. Thanks !!!

    • @IAmTimCorey
      @IAmTimCorey  ปีที่แล้ว +3

      The connection string tells the application where the database is. Since the connection string did not specify a path, it assumes a relative path (relative to the executable running the command that uses the connection string). That's why we have to copy the database into the debug folder. Also, by using a copy of the database instead of the one we include with our project, we won't have sample data in the database we give to customers (unless we want it in there).

  • @aresagathos2075
    @aresagathos2075 3 ปีที่แล้ว

    The reason you need to reference the sql lib also in WinFormUI, is a visual studio bug, that sticks around.
    I usually use typeof on a class from sqlcore lib in the DemoLibrary, so visual studio see's you actually using it, and doesn't get rid of the .dll, and it doesn't need to be referenced in the WinFormUI.

  • @zohirbensalem7622
    @zohirbensalem7622 3 ปีที่แล้ว

    very very nice thanks so much

  • @connecting1409
    @connecting1409 3 ปีที่แล้ว +1

    Hi Tim, i have a question. What is the purpose of the DemoLibrary project? Is that needed or can i have my models and NUGet packages in the UI project?

    • @IAmTimCorey
      @IAmTimCorey  3 ปีที่แล้ว +1

      It keeps a separation between your business logic and data access from your user interface. Putting everything in your UI locks you in by tightly coupling your application together. By using a class library, we can disconnect this and make it easier to upgrade parts of our application without upgrading the entire thing.

  • @mariuszstruzyk8770
    @mariuszstruzyk8770 6 ปีที่แล้ว

    Hello Tim, I'm happy you're back ! I got a question, are you planning on doing a NHibernate 4+ course/tutorial?

    • @IAmTimCorey
      @IAmTimCorey  6 ปีที่แล้ว

      Probably not. It isn't something I use.

  • @sooyx
    @sooyx 3 ปีที่แล้ว +1

    23:00. I get the error "type or namespace "Personmodel" could not be found". Please help and thanks in advance.

    • @IAmTimCorey
      @IAmTimCorey  3 ปีที่แล้ว +1

      You probably did not mark your PersonModel class as public. Either that or you mistyped it as "Personmodel" when you meant "PersonModel".

  • @talha_coding_tutor
    @talha_coding_tutor 6 หลายเดือนก่อน +3

    hey tim bro , how can we store dates and time etc

    • @IAmTimCorey
      @IAmTimCorey  6 หลายเดือนก่อน

      There are options, but the easiest one in my opinion is to use a text field. You could use an integer and calculate seconds from 1970 among other options, but those options aren't human-readable when scanning database columns. I prefer just using text and converting it back to DateTime.

    • @talha_coding_tutor
      @talha_coding_tutor 6 หลายเดือนก่อน

      @@IAmTimCorey So If We Have A DateTimePicker named as DTP this means we can define string theDate = DTP.Value.ToString("yyyy-MM-dd")
      OR Something Like This and Then We Should Store THis String onto the DB

  • @GameOver-ge2hr
    @GameOver-ge2hr 6 ปีที่แล้ว +1

    Hello, I do not understand why you have to create 2 projects (DemoLibrary and WinFormUI) because, it makes you add twice the nuGet packages? Thank you :)

    • @IAmTimCorey
      @IAmTimCorey  6 ปีที่แล้ว +1

      I almost always create a class library because your code should not be directly tied to your user interface. Otherwise it is rigid and hard to update.

    • @GameOver-ge2hr
      @GameOver-ge2hr 6 ปีที่แล้ว

      Hello, thank you for your explanation. This is similar to the MVC, I understand better;) did a series of video to explain precisely how organized his project? I'm waiting for that, the creation of file to "tidy up" these classes, etc., thank you!

  • @pequadcob2009
    @pequadcob2009 4 ปีที่แล้ว

    I am unsure why you need a second project (DemoLibrary) to do this SQLite thing. Could you do all that within one project or do you need to have two projects to accomplish a SQLite database connection?

    • @IAmTimCorey
      @IAmTimCorey  4 ปีที่แล้ว +2

      It is good to separate out your data access from your user interface. That way you can change your user interface without changing your data access. It makes for a cleaner design. You don't have to do it, though.

  • @khunyamascot5741
    @khunyamascot5741 5 ปีที่แล้ว +1

    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.

    • @IAmTimCorey
      @IAmTimCorey  5 ปีที่แล้ว +1

      It sounds like you aren't closing out a transaction to SQLite before you are attempting a different transaction. Make sure you are closing your transactions right away (I'm using "using" statements to ensure they get closed right after the call).

  • @_rcs
    @_rcs 5 ปีที่แล้ว

    You select "Copy if newer" for the db file. Does this mean that after adding a new column to a table using the DB Browser, all of the data in the debug db will be lost the next time you build the project, since the blank db will overwrite it?
    A solution could be to add columns directly to the debug db, but then you risk having mismatched db structures between your blank db and debug db?

    • @IAmTimCorey
      @IAmTimCorey  5 ปีที่แล้ว

      Yes, it will overwrite your database in debug. However, since the database in debug is just for testing, that isn't necessarily bad. Now if you have a bunch of setup data in it for easier testing, that would be a pain. In that case, you will need to manually update your debug database or point to one that isn't copied every time you build.

    • @_rcs
      @_rcs 5 ปีที่แล้ว

      @@IAmTimCorey Awesome, thank you, Tim.

  • @ivandrofly
    @ivandrofly 5 ปีที่แล้ว +1

    thank you! I like you accent btw

  • @Gray-Wolf-Media
    @Gray-Wolf-Media 6 ปีที่แล้ว

    Hey Tim, got a question, are you planning on doing a MySQL video? I was having a problem with a dotnet core app I was working on and at first I thought that my data source to MySQL was wrong but after trashing the program and reverting to SQLServer I found that I was having the same issue with it. Turned out to be a flaw in my Angular code

    • @IAmTimCorey
      @IAmTimCorey  6 ปีที่แล้ว +1

      MySQL is also on the list of database topics.

  • @iandalrymple7255
    @iandalrymple7255 ปีที่แล้ว +1

    I am watching this in 2023 - is there a workaround to having to include that System.Data.Sqlite.Core dependency in your consuming project? I am on a dependency management kick and would like to break that one if possible. Regardless - thank you Tim again for saving me so much time.

    • @IAmTimCorey
      @IAmTimCorey  ปีที่แล้ว +1

      Yes, if you have all of your data access code fully in the class library then the UI doesn't need to know about it.

  • @Angstskrig1976
    @Angstskrig1976 6 ปีที่แล้ว

    Great video as usual.
    I have added a few extras and made a subwindow for the person part - somehow I cant get the data shown in my person window. It seems to save to the DB tho.
    Being new at c# my headaches are only minor, but they will prob grow. :D
    Thx again Tim - great stuff!

    • @IAmTimCorey
      @IAmTimCorey  6 ปีที่แล้ว

      Glad you are working through the issues. I have a video on debugging that might help out. :-)

    • @Angstskrig1976
      @Angstskrig1976 6 ปีที่แล้ว

      I will go have a look- Thx again.

    • @Angstskrig1976
      @Angstskrig1976 6 ปีที่แล้ว +1

      Everything works now. DB seems to be updating and responsive. I love you man! :)

  • @StudentCompanion
    @StudentCompanion 3 ปีที่แล้ว

    What are the advantages of using SQLite over SQL localDB? I guess they are all file based database and with sql localdb you could easily migrate to a full SQL very easily by just changing a connection string I believe. Why would one prefer SQLite over localdb?
    Thanks

    • @IAmTimCorey
      @IAmTimCorey  3 ปีที่แล้ว +1

      SQLite is designed to be portable with just a dll and the database file.

  • @dcaetfvn
    @dcaetfvn 5 ปีที่แล้ว +1

    Hi
    Thannks for your video.
    Do you recommend a way to trace/debug queries on SQLite in C#?

    • @IAmTimCorey
      @IAmTimCorey  5 ปีที่แล้ว

      No, sorry. I don't think I've ever had the need.

    • @dcaetfvn
      @dcaetfvn 5 ปีที่แล้ว

      @@IAmTimCorey How can you make sure to have right queries all the time? I have a syntax error but I can't figure it out how