After you create a new project, in the Package management console, enter:
Install-package linq2db. Sqlite
Enter.
In the previous Turn & wall installed (by the way GFW: I xxx! ), this installation is installed from the local cache.
After the installation is successful, look at the following changes to the project in the solution:
Instant finish is the sense of sight! Have you got any wood?
Finally on the C # operation SQLite example, yesterday just researched out, fresh Oh!
Using system;using system.io;using system.collections.generic;using system.linq;using System.Text;using System.threading.tasks;using System.data.sqlite;namespace consoleapplication1{class Program {static void Ma In (string[] args) {using (sqliteconnection conn = new Sqliteconnection ("Data source=d:\\abc.db")) {Conn. Open (); Droptable (conn); CreateTable (conn); INSERTDATA (conn); GETDATA (conn); Conn. Close (); }} private static void CreateTable (Sqliteconnection conn) {Sqlitecommand cmd = c Onn. CreateCommand (); Cmd. CommandText = @ "CREATE TABLE Question (ID Integer primary key, Que Stioncontent text, htmlcontent text) "; Cmd. ExecuteNonQuery (); } private static void InsertData (Sqliteconnection conn) {Sqlitecommand cmd = conn. CreateCommand (); StringBuilder sb = new StringBuilder (); for (int i = 0; i <; i++) {sb. AppendFormat ("INSERT into Question (id,questioncontent,htmlcontent) VALUES ({0}, ' question content: {1} ', ' Question answer {2} ');", I, Guid.NewGuid (). ToString (), Guid.NewGuid (). ToString ()); } Cmd.commandtext = sb. ToString (); Cmd. ExecuteNonQuery (); } private static void GetData (Sqliteconnection conn) {Sqlitecommand cmd = conn. CreateCommand (); Cmd.commandtext = "SELECT * from Question"; Sqlitedatareader reader = cmd. ExecuteReader (); while (reader. Read ()) {var obj = new {Id = reader. GetInt32 (0), questioncontent = reader. GetString (1), htmlcontent = reader. GetString (2)}; Console.WriteLine (String. Format ("id:{0}; Questioncontent={1}; Htmlcontent={2} ", obj. Id, obj. QuestionContent, obj. Htmlcontent)); }} private static void Droptable (Sqliteconnection conn) {Sqlitecommand cmd = conn. CreateCommand (); Cmd.commandtext = "Drop Table Question"; Cmd. ExecuteNonQuery (); } }}
Finally thanks to the IT person: http://blog.csdn.net/dyllove98/article/details/9674137, I basically copied this blog, and then removed the back of the template part of the temporary.
How to introduce SQLite linq2db in vs2012 and 2013, and the basics of C # operations for SQLite.