SQLiteÊý¾Ý¿âµÄÔöɾ¸Ä²é´úÂë
//ËѼ¯ÕûÀíÁËÒ»ÏÂÍøÉϵĴúÂë.ÕÒÁË°ëÌì¾ÓÈ»ÕÒ²»µ½Ò»Ìõ²åÈëÓï¾ä.ºÃÓôÃƵÄ
//¸Ð¾õËٶȻ¹¿ÉÒÔ.СÎļþ.ºÜ¶àСӦÓóÌÐòÔÚÓÃÕâ¸öÊý¾Ý¿â
//SQLiteʹÓð취.Ö±½ÓCOPYDLLÎļþSystem.Data.SQLite.DLLµ½Ó¦ÓóÌÐòDEBUGĿ¼Ï¡£ È»ºóÔÚÏîÄ¿ÖÐÌí¼ÓÒýÓÃ,ÕÒµ½Õâ¸öÎļþ¼´¿É
//Ìí¼ÓÒýÓÃ
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Net;
using System.Data.SQLite;
private static string FavoriteDbPath = System.Environment.CurrentDirectory + "\\Favorite.db";
private bool CreateSQLiteDb()
{
try
{
System.Data.SQLite.SQLiteConnection.CreateFile(FavoriteDbPath);
System.Data.SQLite.SQLiteConnection Conn = new System.Data.SQLite.SQLiteConnection();
System.Data.SQLite.SQLiteConnectionStringBuilder ConnStr = new System.Data.SQLite.SQLiteConnectionStringBuilder();
ConnStr.DataSource = FavoriteDbPath;
ConnStr.Password = "Admin";//ÉèÖÃÃÜÂ룬SQLite ADO.NETʵÏÖÁËÊý¾Ý¿âÃÜÂë±£»¤
Conn.ConnectionString = ConnStr.ToString();
Conn.Open();
System.Data.SQLite.SQLiteComman
Ïà¹ØÎĵµ£º
1¡¢SQLite¼ò½é
¡¡¡¡SQLiteµÚÒ»¸öAlpha°æ±¾µ®ÉúÓÚ2000Äê5ÔÂ. ÖÁ½ñÒѾÓÐ9¸öÄêÍ·ÁË. SQLiteÒ²ÓÀ´ÁËÒ»¸ö°æ±¾ SQLite 3ÒѾ·¢²¼.
¡¡¡¡SQLiteÊÇÒ»¿îÇáÐ͵ÄÊý¾Ý¿â£¬ÊÇ×ñÊØACIDµÄ¹ØÁªÊ½Êý¾Ý¿â¹ÜÀíϵͳ£¬ËüµÄÉè¼ÆÄ¿±êÊÇǶÈëʽµÄ£¬¶øÇÒÄ¿Ç°ÒѾÔںܶàǶÈëʽ²úÆ·ÖÐʹÓÃÁËËü£¬ËüÕ¼ÓÃ×ÊÔ´·Ç³£µÄµÍ£¬ÔÚǶÈëʽÉ豸ÖУ¬¿ÉÄÜÖ»ÐèÒª¼¸°ÙKµ ......
SQLiteÓô¥·¢Æ÷À´Ìæ´úÍâ¼üÔ¼Êø CREATE TABLE [Category] (
[Pkid] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
[CategoryName] NVARCHAR(32) NOT NULL,
[CategoryGuid] char(36) UNIQUE NOT NULL,
[CategoryDesc] nvarchar(256) NULL
) C ......
1 TOP
ÕâÊÇÒ»¸ö´ó¼Ò¾³£Îʵ½µÄÎÊÌ⣬ÀýÈçÔÚSQLSERVERÖпÉÒÔʹÓÃÈçÏÂÓï¾äÀ´È¡µÃ¼Ç¼¼¯ÖеÄÇ°Ê®Ìõ¼Ç¼£º
SELECT TOP 10 * from [index] ORDER BY indexid DESC;
µ«ÊÇÕâÌõSQLÓï¾äÔÚSQLiteÖÐÊÇÎÞ·¨Ö´Ðеģ¬Ó¦¸Ã¸ÄΪ£º
SELECT * from [index] ORDER BY indexid DESC limit 0,10;
ÆäÖÐlimit 0,10±íʾ´ÓµÚ0Ìõ¼Ç¼¿ªÊ¼£¬Íùºó ......
ÊÂÎñ£¨DbTransaction£©£º
SQLite ȱʡΪÿ¸ö²Ù×÷Æô¶¯Ò»¸öÊÂÎñ£¬ËùÒÔ³ÉÅú²åÈëµÄʱºò£¬Æô¶¯ÊÂÎñ£¬±È²»Æô¶¯ÊÂÎñ¿ìn±¶¡£
ÔÚûÆô¶¯ÊÂÎñ֮ǰÍùSqliteÊý¾Ý¿âÀï²åÈë1000¶àÌõÊý¾ÝµÄÇé¿ö,½á¹ûÿ´Î¶¼ÐèÒªÒ»Á½·ÖÖÓ²ÅÄÜÍê³É.
¶øÔÚÆô¶¯ÊÂÎïÒÔºóËùÐèÒªµÄʱ¼äÖ±½Ó±ä³É²»µ½2Ãë!ÔÀ´sqlite»¨Á½·ÖÖÓÊÇÓÉÓÚExecuteNonQuery·½·¨Ö´ÐÐʱ×Ô¼ºÌá½» ......
±¾ÎÄÒÔÊý¾Ý¿âÖеÄÊý¾Ý±íUserInfoΪʵÀýչʾÊý¾Ý¿â±íµÄ´´½¨¼°Êý¾Ý¼Ç¼µÄ¼Èë¡£
#!/bin/sh
#variables definition
#database location
db=/conf/db
#
#create table userInfo
#name: User name
#passwd: Password
#Privilege: User privilege -- Administrator:0 Operator:1
#
echo "create table UserInfo(n ......