Description: Document-type relational database, more for mobile
1.1 Adding references
' 1.1.1 System.Data.SQLite.xml
1.1.2 System.Data.SQLite.dll
1.2 Settings for connection strings
string connstr = @ "Data source=f:\users\home\documents\visual Studio 2013\paodingjieniu\pdjn.db;version=3;";
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Data.SQLite;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Windows.Forms;namespacefuxi{ Public Partial classForm1:form { PublicForm1 () {InitializeComponent (); } Private voidForm1_Load (Objectsender, EventArgs e) { //00 constructing a collection of dataList<managerinfo> ListManager =NewList<managerinfo>( ); //01-Show Data//01-01 Connection string "physical path; version number": stringConnStr =@"data source=f:\users\home\documents\visual Studio 2013\paodingjieniu\pdjn.db;version=3;"; //01-02 Creating a connection string using(Sqliteconnection conn =Newsqliteconnection (CONNSTR)) { //01-03 Query StatementsSqlitecommand cmd =NewSqlitecommand ("SELECT * from Managerinfo", conn); //01-04 Execute CommandConn. Open (); Sqlitedatareader Reader=cmd. ExecuteReader (); if(reader. HasRows) { while(reader. Read ()) {Listmanager.add (NewManagerinfo () {Mid= Convert.ToInt32 (reader["Mid"]), Mname= reader["Mname"]. ToString (), Mpwd= reader["mpwd"]. ToString (), Mtype=convert.toint32 (reader["Mtype"]) }); } } //02 Display on DataGridViewDatagridview1.datasource =ListManager; } } }}
code Example
usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;namespacefuxi{ Public Partial classManagerinfo { Public intMid {Get;Set; } Public stringMname {Get;Set; } Public stringmpwd {Get;Set; } Public intMtype {Get;Set; } }}
Managerinfo
The use of -58-sqlite