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)
{
Ïà¹ØÎĵµ£º
1. ´ò¿ªÄÚ´æÊý¾Ý¿â
Ö±½Ó´ò¿ªÒ»¸öÃûΪ":memory:"»òÕß Ãû×ÖÖ±½ÓΪ¿ÕµÄÊý¾Ý¿â£¬ Á½ÖÖÊý¾Ý¿âÂÔ΢ÓÐЩÇø±ð¡£
²Î¿¼ £ºhttp://www.sqlite.org/inmemorydb.html
2. ±£´æÄÚ´æÊý¾Ý¿â
3. ÅжϱíÊÇ·ñ´æÔÚ
ͨ¹ý²éѯϵͳ±ísqlite_masterÀ´»ñÈ¡Ïà¹ØÐÅÏ¢
select * f ......
SQLiteºÍÆäËû´ó²¿·ÖÏÖ´úSQLÊý¾Ý¿âÔÚ»ù±¾Éè¼ÆÄ¿±êÉÏÊDz»Í¬µÄ£¬ËüµÄÄ¿±êÊǼòµ¥¡£SQLite×ñÑÕâһĿ±ê£¬¼´Ê¹ÕâÑùż¶û»áµ¼ÖÂijЩÌØÐÔʵÏֵĵÍЧ»¯¡£ÏÂÃæÁоÙÁËSQLiteµÄһЩȱÏÝ£º
SQL-92ÌØÐÔ·½Ãæ
ÕýÈçÇ°ÃæÌáµ½µÄ£¬SQLite²»Ö§³ÖSQL-92µÄÔںܶàÆóÒµÊý¾Ý¿âϵͳÖпÉÓõÄһЩÌØÐÔ¡£
È磺
Íâ¼üÔ¼Êø£¨¿É½âÎöµÄ£¬µ«·ÇÇ¿ÖÆ£©
ºÜ¶àALT ......
SQLiteÊÇÒ»¿îÇáÐ͵ÄÊý¾Ý¿â£¬ÊÇ×ñÊØACIDµÄ¹ØÁªÊ½Êý¾Ý¿â¹ÜÀíϵͳ£¬ËüµÄÉè¼ÆÄ¿±êÊÇǶÈëʽµÄ£¬¶øÇÒÄ¿Ç°ÒѾÔںܶàǶÈëʽ²úÆ·ÖÐʹÓÃÁËËü£¬ËüÕ¼ÓÃ×ÊÔ´·Ç³£µÄµÍ£¬ÔÚǶÈëʽÉ豸ÖУ¬¿ÉÄÜÖ»ÐèÒª¼¸°ÙKµÄÄÚ´æ¾Í¹»ÁË¡£ËüÄܹ»Ö§³ÖWindows/Linux/UnixµÈµÈÖ÷Á÷µÄ²Ù×÷ϵͳ£¬Í¬Ê±Äܹ»¸úºÜ¶à³ÌÐòÓïÑÔÏà½áºÏ£¬±È ......
zz from https://www.dream4ever.org/showthread.php?t=86440 feuvan @ DRL
ÔÎÄÔÚhttp://sqlitecn.feuvan.net/faq.html
Óï·¨²¿·ÖÕýÔÚ·ÒëÖУ¬¾´ÇëÆÚ´ý
FAQÖÐÎÄ°æ
ÈçºÎ´´½¨×ÔÔö×ֶΣ¿
SQLite Ö§³ÖÄÄЩÊý¾ÝÀàÐÍ£¿
ΪʲôÄÜÏò SQLite Êý¾Ý¿âµÄÕûÐÍ×Ö¶ÎÖвåÈë×Ö·û´®£¿
Ϊʲô SQLite ÈÏΪ±í´ïʽ '0'=='00' ΪÕ棿
......
תÔØʱÇë×¢Ã÷³ö´¦ºÍ×÷ÕßÁªÏµ·½Ê½£ºhttp://blog.csdn.net/absurd
×÷ÕßÁªÏµ·½Ê½£ºLi XianJing <xianjimli at hotmail dot com>
¸üÐÂʱ¼ä£º2006-12-19
SqliteÊÇÒ»¸öÓÃCÓïÑÔʵÏÖµÄСÐÍSQLÊý¾Ý¿âÒýÇæ¡£ËüÌå»ýСÇɵ«¹¦ÄÜÇ¿´ó£¬¶ÔÓ²¼þ×ÊÔ´ÒªÇóºÜµÍ¶øÇÒÐÔÄܱíÏÖ׿Խ£¬·Ç³£ÊʺÏÓÚǶÈëʽӦÓû·¾³¡£×î½ü·¢ÏÖsqlite²¢²»Ö§³ÖÖÐÎ ......