This article is a mirror article of machine translation, please click here to jump to the original article.

View: 11192|Reply: 6

[Source] [Actual combat]. NET/C# Create an SQLite database and simply add, delete, modify

[Copy link]
Posted on 12/10/2021 8:54:29 PM | | | |
In the past, when developing Winform gadgets, configuration files were often stored in text as json strings, which was suitable for simple data storage. SQL Server and MySQL are too heavy, and you need to build an environment on the computer, SQLite, is a lightweight database, is an ACID-compliant relational database management system, it is contained in a relatively small C library.

In simple terms, SQLite is a database file that supports multiple languages and cross-platforms. It can be used on Windows, Linux, mobile (Android), and other platforms.

Review:

SQLite database management tool
https://www.itsvse.com/thread-4026-1-1.html
Create a new .NET Core 3.1 project (Code can be migrated directly to the .NET framework

Download two .cs files from the GitHub repository,The two .cs files are a complete SQLite ORM frameworkAddress:The hyperlink login is visible.

copySQLite.cs、SQLiteAsync.csfile into the project (if you don't use asynchronous SQLiteAsync.cs, you can do without copying), as shown in the image below:



Download the SQLite binary at the following address:The hyperlink login is visible.

I download "SQLite version 3.37.0 32-bit DLL (x86)" here, address:The hyperlink login is visible., unzip the package, copy sqlite3.dll into the project,Copy the setup file if it is newer

Create a new UserInfo table, simply add, delete, modify the table, and check the code:

Since I'm using a 32-bit DLL, put the projectThe target platform is changed to x86, as shown in the figure below:



Run the program, and the execution result is as shown in the figure below:



Source code download:

The hyperlink login is visible.





Previous:CryptoJS DES front-end encryption decryption
Next:The .NET program tests the Java project log4j2 for a remote code execution vulnerability
Posted on 12/26/2021 4:55:47 PM |
Come and learn again...
Posted on 6/17/2022 9:34:12 AM |
Study, I'm here again, collect! ~~~~~~~~~~~~~~~
Posted on 9/2/2022 9:46:30 AM |
Take a look and learn
Posted on 1/19/2023 9:52:36 AM |
Learn to learn
 Landlord| Posted on 5/21/2023 6:27:52 PM |
LiteDB Embedded Database for .NET tutorial
https://www.itsvse.com/thread-10592-1-1.html
 Landlord| Posted on 7/26/2024 10:02:58 AM |
[Practice] Use Dapper to operate SQLite databases
https://www.itsvse.com/thread-10799-1-1.html
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com