SQLite Programming related

Source: Internet
Author: User
Tags sqlite sqlite database visual studio

SQLite Open Source, the code is simple, powerful enough, very extensive use, in this collation of C + + SQLite database programming related to some knowledge.

One. SQLite Build a table

Two. In VS environment, the method of using SQLite in 32-bit program

Three. The use method of SQLite in 64-bit environment

VS Version: VS2012

SQLite version: 3080401

One. SQLite Build a table

?

1 2 3 4 5 6 7 8 9 10 11 CD c:sqlite sqlite3.exe mydict.db CREATE TABLE userpwd (ID integer primary key autoincrement,pwd Varchvar (30));   Insert into USERPWD (PWD) VALUES (' AAA ');   Insert into USERPWD (PWD) VALUES (' 123456 ');   SELECT * from Userpwd; . Quit

Two. In VS environment, the method of using SQLite in 32-bit program

First download sqlite-dll-win32-x86 get the DLL and DEF file, and then use Lib.exe to manually generate the Lib file needed for vs to be used in the VS environment.

1. Find Mspdb110.dll from the VS IDE and copy it to the directory where the Lib.exe program resides

Mspdb110.dll are stored in the following directory:

C:Program Files (x86) Microsoft Visual Studio 11.0common7ide

2. Enter Lib.exe directory, run command to get Lib

Lib.exe is located in the following directory:

C:Program Files (x86) Microsoft Visual Studio 11.0VCbin

command to generate LIB:

?

1 2 3 4 5 C:Program Files (x86) Microsoft Visual Studio 11.0vcbin>lib.exe/machine:ix86/def:c:sqlitesqlite3.def/out:c:  Sqlitesqlite3.lib Microsoft (R) Library Manager Version 11.00.60610.1 Copyright (C) Microsoft Corporation.      All rights reserved. Creating library C:sqlitesqlite3.lib and Objects C:sqlitesqlite3.exp

3. Will be copied to the directory of the lib.exe of the Mspdb110.dll to delete, do not clean up the program will be when the error vs.

4. Reference header file, Lib start using database

#include "Sqlite3.h"

#pragma comment (lib, "Sqlite3.lib")

Three. The use method of SQLite in 64-bit environment

SQLite's library is 32-bit, so when compiling the program into 64-bit, there will be an error.

At this time by going to the official website directly download SQLite source file, the source code integrated into the project project in the way you can use it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.