One on hand at the moment. NET project used SQLite, this is my first contact and use of SQLite, the overall feeling is very good. Here I would like to share with you the experience of using SQLite.
First. About SQLite
SQLite is an open source, lightweight database for use in both client and embedded devices, and supports standard SQL.
Unlike SQL Server or Oracle's engine, which is a stand-alone process, communicates with a program via TCP or Named pipes, SQLite is a part of a program, a component, and uses SQLite to make API calls directly in the program.
The original SQLite is not a visual operation to SQL Server Enterprise Manager, but there is a third-party development of the application Sqlitestudio is very good, basic building, table, edit data, export data and other functions are supported very well. The Sqlitestudio run screenshot looks like this:
SQLite Resource Link:
(1) SQLite official website: You can download the source code from the official website, or download the binary version of the compiled good. Supported systems include: Linux, MacOS, Windows,. NET.
(2) Sqlitestudio: Easy to use SQLite visual manager.
Second. Using SQLite in. Net
Download from the official website. NET version of the SQLite, which mainly includes two Dll:SQLite.Interop.dll, System.Data.SQLite.dll.
(1) System.Data.SQLite.dll is a standard managed DLL that can be referenced and used directly in a. NET project, just as it is with individual objects in the. Net System.Data namespace.
(2) SQLite.Interop.dll is an unmanaged DLL, is the SQLite engine core, we need to copy it to the run directory, at runtime, it will be called System.Data.SQLite.dll.
Third. Let SQLite out of VC + + runtime
When we tested after the project was developed, we found that the client program that used the SQLite would complain when running on some machines, as follows:
The DLL "SQLite.Interop.DLL" could not be loaded, and the application could not be started because the application was improperly configured. Reinstalling the application may correct the problem. (Exception from HRESULT:0X800736B1)
After some toss, only to find that these machines are not installed on the VC + + runtime (Visual C + + SP1 runtime), while the SQLite.Interop.dll run is required by VC + + Runtime support. This is not very friendly. Our project is based on. NET 2.0, and Windows XP SP1 and above have this framework, and these machines do not necessarily have VC + + runtime installed. So my first reaction was to try to get SQLite to run on the machine without installing VC + +.
1. Programme I
I have been Baidu a bit, there is a plausible solution is this: the Msvcm80.dll, Msvcp80.dll, msvcr80.dll These dynamic libraries are also placed in the running directory. I didn't like the plan very much, so I tried to solve the problem by myself.
2. Programme II
By virtue of what I have not completely forgotten a little VC base, I know VC program in the compilation can choose to dynamically link to rely on the library or static link, if it is static connection, the compiler generated binary program is equivalent to include a copy of a dependent library. So, my idea is to recompile SQLite.Interop.dll and make it statically linked to VC + + runtime. I downloaded the source code of SQLite, opened with VS2010, screenshot as follows:
SQLITE.INTEROP.2010 This project is the core, we need some of its settings to make some changes, these small changes I spent some time groping to succeed, here to omit the specific process of exploration, directly to explore the results:
(1) Open the SQLITE.INTEROP.2010 Project Properties page, configure the properties-> the C + +-> code generation-> Run-time Library, which is set to multithreaded debugging (/MTD).
(2) Continue to configure the Properties-> Inventory Tool-> input and output-> embedded inventory, which is "yes", changed to "no".
(3) Show all project files, then locate the Sqlite.interop.2010.props file and open it. Remove the <INTEROP_MIXED_NAME> configuration node.
(4) Remove the Resource Files folder from the project.
(5) Recompile the project, the generated SQLite.Interop.dll is what we need.
Fourth. Download results
Unless the special needs, otherwise we do not need to repeat the process, I will generate the SQLite binary version directly available to you to download the use.
Add: SQLite official website has provided a static connected library
Http://system.data.sqlite.org/downloads/1.0.93.0/ Sqlite-netfx20-static-binary-bundle-win32-2005-1.0.93.0.zip