Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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)
{


Ïà¹ØÎĵµ£º

SQLiteÈëÃÅÓë·ÖÎö(Ò»)

 ÒòΪÏîÄ¿ÐèÒª£¬ÐèҪʹÓÃsqlite£¬ÔÚcsdnµÄblogÖУ¬·¢ÏÖÁË´ËÎÄÕ£¬
ÒÔÏÂϵÁоùÕª×Ô£ºhttp://www.cnblogs.com/hustcat/  лл£¡
1¡¢SQLite½éÉÜ
×Ô¼¸Ê®ÄêÇ°³öÏÖµÄÉÌÒµÓ¦ÓóÌÐòÒÔÀ´£¬Êý¾Ý¿â¾Í³ÉΪÈí¼þÓ¦ÓóÌÐòµÄÖ÷Òª×é³É²¿·Ö¡£ÕýÓëÊý¾Ý¿â¹ÜÀíϵͳ·Ç³£¹Ø¼üÒ»Ñù£¬ËüÃÇÒ²±äµÃ·Ç³£ÅӴ󣬲¢Õ¼ÓÃÁËÏ൱¶àµÄϵͳ×ÊÔ´£¬Ôö¼ ......

SQLITEµÄ¾ÖÏÞÐÔ

SQLiteºÍÆäËû´ó²¿·ÖÏÖ´úSQLÊý¾Ý¿âÔÚ»ù±¾Éè¼ÆÄ¿±êÉÏÊDz»Í¬µÄ£¬ËüµÄÄ¿±êÊǼòµ¥¡£SQLite×ñÑ­ÕâһĿ±ê£¬¼´Ê¹ÕâÑùż¶û»áµ¼ÖÂijЩÌØÐÔʵÏֵĵÍЧ»¯¡£ÏÂÃæÁоÙÁËSQLiteµÄһЩȱÏÝ£º
SQL-92ÌØÐÔ·½Ãæ
ÕýÈçÇ°ÃæÌáµ½µÄ£¬SQLite²»Ö§³ÖSQL-92µÄÔںܶàÆóÒµÊý¾Ý¿âϵͳÖпÉÓõÄһЩÌØÐÔ¡£
È磺
Íâ¼üÔ¼Êø£¨¿É½âÎöµÄ£¬µ«·ÇÇ¿ÖÆ£©
ºÜ¶àALT ......

sqliteÐÔÄÜÓÅ»¯

Ö÷Ҫͨ¹ýpragmaÖ¸ÁîÀ´ÊµÏÖ¡£
±ÈÈ磺 ¿Õ¼äÊÍ·Å¡¢´ÅÅÌͬ²½¡¢Cache´óСµÈ¡£
²»Òª´ò¿ª¡£Ç°ÎÄÌá¸ßÁË£¬VacuumµÄЧÂʷdz£µÍ£¡
PRAGMA auto_vacuum;
PRAGMA auto_vacuum = 0 | 1;
²éѯ»òÉèÖÃÊý¾Ý¿âµÄauto-vacuum±ê¼Ç¡£
Õý³£Çé¿öÏ£¬µ±Ìá½»Ò»¸ö´ÓÊý¾Ý¿âÖÐɾ³ýÊý¾ÝµÄÊÂÎñʱ£¬Êý¾Ý¿âÎļþ²»¸Ä±ä´óС¡£Î´Ê¹ÓõÄÎļþÒ³±»±ê¼Ç²¢ÔÚÒÔ ......

SqliteÖÐÎÄÅÅÐòÑо¿

תÔØʱÇë×¢Ã÷³ö´¦ºÍ×÷ÕßÁªÏµ·½Ê½£ºhttp://blog.csdn.net/absurd
×÷ÕßÁªÏµ·½Ê½£ºLi XianJing <xianjimli at hotmail dot com>
¸üÐÂʱ¼ä£º2006-12-19
SqliteÊÇÒ»¸öÓÃCÓïÑÔʵÏÖµÄСÐÍSQLÊý¾Ý¿âÒýÇæ¡£ËüÌå»ýСÇɵ«¹¦ÄÜÇ¿´ó£¬¶ÔÓ²¼þ×ÊÔ´ÒªÇóºÜµÍ¶øÇÒÐÔÄܱíÏÖ׿Խ£¬·Ç³£ÊʺÏÓÚǶÈëʽӦÓû·¾³¡£×î½ü·¢ÏÖsqlite²¢²»Ö§³ÖÖÐÎ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ