資源簡介
首先需要:
1、打開壓縮包中_Lib文件夾下的 SQLite-1.0.66.0-setup.exe文件(ADO.NET provider for the SQLite database engine). 然后安裝。
2、安裝完畢后 打開項目 測試即可。 其中包含了 SQLite數據庫的基本操作,可直接拿來使用。
SQLite數據庫注意事項:
1、在新建SQLite數據庫的時候,可直接右鍵新建記事本后 將記事本的后綴直接改成 .db后綴即可使用。
2、SQLite新建表字段的時候 無須考慮類型,如下:
假設我們要建一個名叫film的資料表,只要鍵入以下指令就可以了:
create table film(title, length, year, starring);
這樣我們就建立了一個名叫film的資料表,里面有name、length、year、starring四個字段。
這個create table指令的語法為:
create table table_name(field1, field2, field3, ...);
table_name是資料表的名稱,fieldx則是字段的名字。sqlite3與許多SQL數據庫軟件不同的是,它不在乎字段屬于哪一種資料型態:sqlite3的字段可以儲存任何東西:文字、數字、大量文字(blub),它會在適時自動轉換。
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Data.SQLite;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;
namespace?SQLiteDemo
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????///?
????????///?創建表
????????///?
????????///?
????????///?
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????SQLiteDemo.SQLiteHelper.ExecuteNonQuery(“create?table?tbusers?(username)?“null);
????????????MessageBox.Show(“創建表成功“);
????????}
????????///?
????????///?插入語句
????????///?
????????//
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2012-12-13?17:56??SQLiteDemo\
?????目錄???????????0??2012-12-13?18:06??SQLiteDemo\SQLiteDemo\
?????文件????????1042??2012-12-13?18:05??SQLiteDemo\SQLiteDemo.sln
?????文件???????25088??2012-12-13?18:55??SQLiteDemo\SQLiteDemo.v11.suo
?????文件?????????117??2012-12-13?18:06??SQLiteDemo\SQLiteDemo\app.config
?????目錄???????????0??2012-12-13?17:49??SQLiteDemo\SQLiteDemo\bin\
?????目錄???????????0??2012-12-13?18:55??SQLiteDemo\SQLiteDemo\bin\Debug\
?????文件???????12800??2012-12-13?18:55??SQLiteDemo\SQLiteDemo\bin\Debug\SQLiteDemo.exe
?????文件?????????117??2012-12-13?18:06??SQLiteDemo\SQLiteDemo\bin\Debug\SQLiteDemo.exe.config
?????文件???????28160??2012-12-13?18:55??SQLiteDemo\SQLiteDemo\bin\Debug\SQLiteDemo.pdb
?????文件???????21464??2012-12-13?18:06??SQLiteDemo\SQLiteDemo\bin\Debug\SQLiteDemo.vshost.exe
?????文件?????????117??2012-12-13?18:06??SQLiteDemo\SQLiteDemo\bin\Debug\SQLiteDemo.vshost.exe.config
?????文件?????????490??2010-03-17?22:39??SQLiteDemo\SQLiteDemo\bin\Debug\SQLiteDemo.vshost.exe.manifest
?????文件??????159232??2012-12-13?17:52??SQLiteDemo\SQLiteDemo\bin\Debug\System.Data.SQLite.dll
?????文件????????2048??2012-12-13?18:49??SQLiteDemo\SQLiteDemo\bin\Debug\test.db
?????目錄???????????0??2012-12-13?17:49??SQLiteDemo\SQLiteDemo\bin\Release\
?????文件????????2017??2012-12-13?18:53??SQLiteDemo\SQLiteDemo\Form1.cs
?????文件????????4810??2012-12-13?18:31??SQLiteDemo\SQLiteDemo\Form1.Designer.cs
?????文件????????5817??2012-12-13?18:31??SQLiteDemo\SQLiteDemo\Form1.resx
?????目錄???????????0??2012-12-13?17:28??SQLiteDemo\SQLiteDemo\obj\
?????目錄???????????0??2012-12-13?18:55??SQLiteDemo\SQLiteDemo\obj\Debug\
?????文件????????1085??2012-12-13?18:06??SQLiteDemo\SQLiteDemo\obj\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件????????6399??2012-12-13?18:55??SQLiteDemo\SQLiteDemo\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件?????????683??2012-12-13?18:55??SQLiteDemo\SQLiteDemo\obj\Debug\SQLiteDemo.csproj.FileListAbsolute.txt
?????文件?????????847??2012-12-13?18:55??SQLiteDemo\SQLiteDemo\obj\Debug\SQLiteDemo.csproj.GenerateResource.Cache
?????文件???????12800??2012-12-13?18:55??SQLiteDemo\SQLiteDemo\obj\Debug\SQLiteDemo.exe
?????文件?????????180??2012-12-13?18:55??SQLiteDemo\SQLiteDemo\obj\Debug\SQLiteDemo.Form1.resources
?????文件???????28160??2012-12-13?18:55??SQLiteDemo\SQLiteDemo\obj\Debug\SQLiteDemo.pdb
?????文件?????????180??2012-12-13?18:55??SQLiteDemo\SQLiteDemo\obj\Debug\SQLiteDemo.Properties.Resources.resources
?????文件???????????0??2012-12-13?18:06??SQLiteDemo\SQLiteDemo\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
?????文件???????????0??2012-12-13?18:06??SQLiteDemo\SQLiteDemo\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
............此處省略16個文件信息
- 上一篇:Linq操作DataSet
- 下一篇:C#實現對軟件加密(根據機器碼生成 激活碼)
評論
共有 條評論