C#ÓëSqliteÊý¾Ý¿â²Ù×÷ʵÀý
ÕâÊÇÒ»¸öÓйطÖÒ³µÄʵÀý,½ö¹©²Î¿¼(´úÂëÀ´×ÔÍøÂç)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SQLite;
using System.Threading;
using System.Collections;
using System.IO;
namespace ReadCardDemo
{
public partial class Form3 : Form
{
Form4 form4 = new Form4();
int pageSize = 12; //ÿҳÏÔʾÐÐÊý
int nMax = 0; //×ܼǼÊý
int totalPage = 0; //×ÜÒ³Êý£½×ܼǼÊý/ÿҳÏÔʾÐÐÊý
int currentPage = 1; //µ±Ç°Ò³ºÅ
int pageCount = 0; //µ±Ç°Ò³ÊýµÄ¼Ç¼Êý
int selectRow; //µ±Ç°Ñ¡ÖеÄÐÐÊý
DataSet dataSet = new DataSet();
DataTable dataTable = new DataTable();
SQLiteDataAdapter dataAdapter;
SQLiteConnection conn = new SQLiteConnection();
SQLiteCommand cmd;
SQLiteDataReader dr;
string datasource;
string _sql;
public Form3()
{
InitializeComponent();
}
//³õʼ»¯Êý¾Ý
public void InitializeDataSource()
{
dataTable.Clear();
dataTable.AcceptChanges();
//´´½¨Êý¾Ý¿â
//datasource = "/Windows/ReadCardDemo/PersonId.db";
//SQLiteConnection.CreateFile(datasource);
//½¨Á¢Êý¾Ý¿âÁ¬½Ó
datasource = @"Data Source=/Windows/ReadCardDemo/PersonId.db";
conn.ConnectionString = datasource;
//»ñÈ¡µ±Ç°Êý¾Ý¿âµÄ¼Ç¼Êý
_sql = "select count(*) from PersonId";
conn.Open();
cmd = new SQLiteCommand(_sql, conn);
dr = cmd.ExecuteReader();
while (dr.Read())
{
try
{
nMax = Convert.ToInt32(dr.GetValue(0));
}
catch(Exception e)
{
Ïà¹ØÎĵµ£º
£¨2£© SQLÓï¾ä²Ù×÷
±¾½Ú½éÉÜÈçºÎÓÃsqlite Ö´Ðбê×¼ sql Óï·¨¡£
i.1 Ö´ÐÐsqlÓï¾ä
int sqlite3_exec(sqlite3*, const char *sql, sqlite3_callback, void ......
¡ïÈçºÎȨºâ£¿
¡¡¡¡µ±ÄãÔÚȨºâij¸ö³¡ºÏÊÇ·ñÓ¦¸ÃʹÓÃSQLiteʱ£¬£¨ÔÚ¼¼Êõ²ãÃ棩ÖÁÉÙÒª¿¼ÂÇÈçϼ¸µã£º
¡¡¡¡¡óÄÜ·ñ·¢»ÓSQLiteµÄijЩÌس¤£¿
¡¡¡¡¡óÊÇ·ñ»¹ÓÐÆäËüµÄÌæ´ú·½°¸£¿
¡¡¡¡¡óÊÇ·ñÓÐɶDZÔڵļ¼Êõ·çÏÕ£¿
¡¡¡¡ÏëÇå³þÉÏÊöÎÊÌâÖ®ºó£¬ÔÙ×ö³ö¾ö²ß¡£
¡¡¡¡¡ïSQLiteµÄÌصã
¡¡¡¡¹ØÓÚSQLiteµÄÌس¤£¬ÔÚÉϴεÄÌû×ÓÖÐÒѾ½éÉܹýÁË¡£ ......
  ......
ÕâÁ½ÌìC/SµÄÏîÄ¿ÖÐÓõ½ÁËsqlite£¬Õâ¸öС¶«Î÷»¹ÕæÊǺÃÓ᣷ÃÎÊËٶȺܿ첻˵£¬Éú³ÉµÄÊý¾Ý¿âÎļþÒ²ºÜС¡£·Ç³£ÊʺÏСÐÍÏîÄ¿µÄÊý¾Ý¿â¡£winceÖÐÇ¿ÁÒ½¨ÒéʹÓá£
²»¹ý½ñÌìÓöµ½Ò»¸öÎÊÌâÈÃÈËÍ·´ó£¬deleteÊý¾ÝµÄʱºòÌáʾno such table¡£
Êý¾Ý¿âÖеıíÃ÷Ã÷´æÔÚ£¬ÔÚÊý¾Ý¿âÖÐÖ´ÐÐdeleteµÄsqlҲûÓÐÎÊÌâ¡£¿´À´²»ÊÇsqlÓï¾äµÄÎÊÌâ¡£
µ«ÊÇÖ ......
1¡¢SQLite¼ò½é
¡¡¡¡SQLiteµÚÒ»¸öAlpha°æ±¾µ®ÉúÓÚ2000Äê5ÔÂ. ÖÁ½ñÒѾÓÐ4¸öÄêÍ·ÁË. SQLiteÒ²ÓÀ´ÁËÒ»¸ö°æ±¾ SQLite 3ÒѾ·¢²¼.
¡¡
¡¡SQLiteÊÇÒ»¿îÇáÐ͵ÄÊý¾Ý¿â£¬ÊÇ×ñÊØACIDµÄ¹ØÁªÊ½Êý¾Ý¿â¹ÜÀíϵͳ£¬ËüµÄÉè¼ÆÄ¿±êÊÇǶÈëʽµÄ£¬¶øÇÒÄ¿Ç°ÒѾÔںܶàǶÈëʽ²úÆ·ÖÐʹÓÃÁËËü£¬ËüÕ¼ÓÃ×Ê
Ô´·Ç³£µÄµÍ£¬ÔÚǶÈëʽÉ豸ÖУ¬¿ÉÄÜÖ»ÐèÒª ......