Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : Sqlite

SQLITEËÙ¶ÈÆÀ²â

SQLite ×÷Ϊһ¸öÇáÁ¿¼¶Ç¶ÈëʽÊý¾Ý¿â£¬»¹ÊǷdz£ºÃÓõġ£ÓêºÛ¼«Á¦ÍƼö~~~~~~ 
½ñÌìÓиöÅóÓѲâÊÔ SQLite£¬È»ºóµÃ³öµÄ½áÂÛÊÇ£ºSQLite ЧÂÊÌ«µÍ£¬ÅúÁ¿²åÈë1000Ìõ¼Ç¼£¬¾ÓÈ»ºÄʱ 2 ·ÖÖÓ£¡
ÏÂÃæÊÇËû·¢¸øÎҵIJâÊÔ´úÂë¡£ÎÒÔÎ~~~~~~ 
using System.Data;
using System.Data.Common;
using System.Data.SQLite;
// ´´½¨Êý¾Ý¿âÎļþ
File.Delete("test1.db3");
SQLiteConnection.CreateFile("test1.db3");
DbProviderFactory factory = SQLiteFactory.Instance;
using (DbConnection conn = factory.CreateConnection())
{
  // Á¬½ÓÊý¾Ý¿â
  conn.ConnectionString = "Data Source=test1.db3";
  conn.Open();
  // ´´½¨Êý¾Ý±í
  string sql = "create table [test1] ([id] INTEGER PRIMARY KEY, [s] TEXT COLLATE NOCASE)";
  DbCommand cmd = conn.CreateCommand();
  cmd.Connection = conn;
  cmd.CommandText = sql;
  cmd.ExecuteNonQuery();
  // Ìí¼Ó²ÎÊý
  cmd.Parameters.Add(cmd.CreateParameter());
  
  ......

ÎÒÃÇÒ»Æðѧϰ sqlite µÄÓ¦ÓÃ


                                                                               ×÷Õߣº zieckey ( zieckey@yahoo.com.cn )
                   
                           µÚÒ»Õ ´ÓÕâÀ↑ʼ
1.0 ÒýÑÔ
    ×î½ü·¢ÏÖÍøÉϺܶàÈËÔÚÎÄ sqlite Êý¾Ý¿âµÄÎÊÌ⣬¿ÉÊǽâ´ðµÄÈ˲¢²»¶à¡£ÓÚÊÇÃÈÉúÁËдµãÕâ·½ÃæµÄÎÄÕµÄÄîÍ·¡£ËäÈ»ÎÒÒ²ÊǸսӴ¥ sqlite ²»µ½°ëÄ꣬¶ÔÆäÁ˽âµÃÒ²²»ÊǺÜÉîºÜ͸³¹£¬µ«ÊÇдµã¶«Î÷ÈóõѧÕßÄܹ»ºÜ¿ìÉÏÊÖ£¬Ò²ËãÊÇÎÒµÄÐÄÔ¸Ö®Ò»¡£Ò²ÐíºÜ¶à¸ßÊÖ»á¾õ ......

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

 ÒòΪÏîÄ¿ÐèÒª£¬ÐèҪʹÓÃsqlite£¬ÔÚcsdnµÄblogÖУ¬·¢ÏÖÁË´ËÎÄÕ£¬
ÒÔÏÂϵÁоùÕª×Ô£ºhttp://www.cnblogs.com/hustcat/  лл£¡
1¡¢SQLite½éÉÜ
×Ô¼¸Ê®ÄêÇ°³öÏÖµÄÉÌÒµÓ¦ÓóÌÐòÒÔÀ´£¬Êý¾Ý¿â¾Í³ÉΪÈí¼þÓ¦ÓóÌÐòµÄÖ÷Òª×é³É²¿·Ö¡£ÕýÓëÊý¾Ý¿â¹ÜÀíϵͳ·Ç³£¹Ø¼üÒ»Ñù£¬ËüÃÇÒ²±äµÃ·Ç³£ÅӴ󣬲¢Õ¼ÓÃÁËÏ൱¶àµÄϵͳ×ÊÔ´£¬Ôö¼ÓÁ˹ÜÀíµÄ¸´ÔÓÐÔ¡£Ëæ×ÅÈí¼þÓ¦ÓóÌÐòÖð½¥Ä£¿éÄ£¿é»¯£¬Ò»ÖÖÐÂÐÍÊý¾Ý¿â»á±È´óÐ͸´ÔӵĴ«Í³Êý¾Ý¿â¹ÜÀíϵͳ¸üÊÊÓ¦¡£Ç¶ÈëʽÊý¾Ý¿âÖ±½ÓÔÚÓ¦ÓóÌÐò½ø³ÌÖÐÔËÐУ¬ÌṩÁËÁãÅäÖã¨zero-configuration£©ÔËÐÐģʽ£¬²¢ÇÒ×ÊÔ´Õ¼Ó÷dz£ÉÙ¡£
SQLiteÊÇÒ»¸ö¿ªÔ´µÄǶÈëʽ¹ØϵÊý¾Ý¿â£¬ËüÔÚ2000ÄêÓÉD. Richard Hipp·¢²¼£¬ËüµÄ¼õÉÙÓ¦ÓóÌÐò¹ÜÀíÊý¾ÝµÄ¿ªÏú£¬SQLite¿ÉÒÆÖ²ÐԺ㬺ÜÈÝÒ×ʹÓ㬺ÜС£¬¸ßЧ¶øÇÒ¿É¿¿¡£
SQLiteǶÈ뵽ʹÓÃËüµÄÓ¦ÓóÌÐòÖУ¬ËüÃǹ²ÓÃÏàͬµÄ½ø³Ì¿Õ¼ä£¬¶ø²»Êǵ¥¶ÀµÄÒ»¸ö½ø³Ì¡£´ÓÍⲿ¿´£¬Ëü²¢²»ÏñÒ»¸öRDBMS£¬µ«ÔÚ½ø³ÌÄÚ²¿£¬ËüÈ´ÊÇÍêÕûµÄ£¬×Ô°üº¬µÄÊý¾Ý¿âÒýÇæ¡£
ǶÈëʽÊý¾Ý¿âµÄÒ»´óºÃ´¦¾ÍÊÇÔÚÄãµÄ³ÌÐòÄÚ²¿²»ÐèÒªÍøÂçÅäÖã¬Ò²²»ÐèÒª¹ÜÀí¡£ÒòΪ¿Í»§¶ËºÍ·þÎñÆ÷ÔÚͬһ½ø³Ì¿Õ¼äÔËÐС£SQLite µÄÊý¾Ý¿âȨÏÞÖ»ÒÀÀµÓÚÎļþϵͳ£¬Ã»ÓÐÓû§ÕÊ»§µÄ¸ÅÄî¡£SQLite ÓÐÊý¾Ý¿â¼¶Ë ......

SQLiteÈçºÎɾ³ý¡¢Ð޸ġ¢ÖØÃüÃûÁУ¿

Ê×ÏÈÉùÃ÷£ºÈç¹ûÄãÏëÖ±½Óalter£¬·ÅÆú°É¡£ÒÔÏÂÄÚÈÝ¿ÉÒÔºöÂÔÁË¡£
sqlite¹Ù·½ËµÃ÷ÈçÏ£º
SQLite supports a limited subset of ALTER TABLE. The ALTER TABLE command in SQLite allows the user to rename a table or to add a new column to an existing table. It is not possible to rename a column, remove a column, or add or remove constraints from a table.
´ó¸ÅÒâ˼ÊÇsqliteµÄalter¹¦ÄÜÖ»ÊÇalter tableµÄÒ»¸ö×Ó¼¯£¬Ö»Óв¿·Ö¹¦ÄÜ£¬±ÈÈçÖØÃüÃû±íÃû£¬ÐÂÔöÁе½ÏÖÓбíÖС£
²»Ö§³ÖÏÖÓÐÁеÄÖØÃüÃû£¬É¾³ýºÍÐ޸ġ£
ÎÒÃÇÖ»ÄÜͨ¹ýÁÙʱ±íÀ´½â¾ö¡£
BEGIN TRANSACTION;
CREATE TEMPORARY TABLE temp_table(a);
INSERT INTO temp_table SELECT a from ±í;
DROP TABLE ±í;
CREATE TABLE ±í(a);
INSERT INTO ±í SELECT a from temp_table;
DROP TABLE temp_table;
COMMIT;
ÕâÑù¿ÉÒÔ½â¾ö£¬µ«ÊÇÈç¹ûÓÐ×ÔÔöÖ÷¼üµÄ»°£¬ÄǾÍҪСÐÄÁË¡£ ......

sqliteÖб¨no such tableµÄ´íÎó½â¾ö·½·¨

ÕâÁ½ÌìC/SµÄÏîÄ¿ÖÐÓõ½ÁËsqlite£¬Õâ¸öС¶«Î÷»¹ÕæÊǺÃÓ᣷ÃÎÊËٶȺܿ첻˵£¬Éú³ÉµÄÊý¾Ý¿âÎļþÒ²ºÜС¡£·Ç³£ÊʺÏСÐÍÏîÄ¿µÄÊý¾Ý¿â¡£winceÖÐÇ¿ÁÒ½¨ÒéʹÓá£
²»¹ý½ñÌìÓöµ½Ò»¸öÎÊÌâÈÃÈËÍ·´ó£¬deleteÊý¾ÝµÄʱºòÌáʾno such table¡£
Êý¾Ý¿âÖеıíÃ÷Ã÷´æÔÚ£¬ÔÚÊý¾Ý¿âÖÐÖ´ÐÐdeleteµÄsqlҲûÓÐÎÊÌâ¡£¿´À´²»ÊÇsqlÓï¾äµÄÎÊÌâ¡£
µ«ÊÇ֮ǰÓиö´°Ìå¸úÏÖÔÚÕâ¸ö´°ÌåʹÓõÄÊÇһģһÑùµÄ·½·¨£¬ÔõôǰÃæÄǸö¾Í¿ÉÒÔ£¬µ½Õâ¸ö´°Ìå¾Í²»ÐÐÁËÄØ£¿
·ÖÎöÁËÒ»ÏÂÁ½¸ö´°ÌåµÄÇø±ð£¬·¢ÏÖÇ°ÕßÊÇshow£¬ºóÕßÊÇShowDialog ¡£ÄѵÀÎÊÌâ³öÔÚÕâÀ
µ÷ÊÔ·¢ÏÖ£¬¹û²»ÆäÈ»¡£
ÒòΪÎÒÁ¬½ÓÊý¾Ý¿âµÄʱºòдµÄÊÇdatasoure="db"£¬¶øshow³öÀ´µÄ´°ÌåÊÇÔÚdebugÏÂÃæÈ¥²éÕÒ£¬¶øShowDialog³öÀ´µÄ´°ÌåÔò²»ÊÇ¡£
ËùÒÔ½â¾ö·½Ê½ÊÇdatasoureºóÃæµÄÊý¾Ý¿â½¨Òé¹¹ÔìΪÎïÀí·¾¶£¬ÖÁÓÚÔõô¹¹Ô죬×Ô¼ºÏë°ì·¨°Ñ¡£Èç¹ûд³ÉĬÈϵÄ·¾¶£¬·¢²¼ÒÔºóÄãµÄÏîÄ¿¾ÍÓò»ÁË¡£
ÎÊÌâÊǽâ¾öÁË£¬µ«ÊǺóÍ·Ò»Ï룬sqlite»á·¸ÕâÑùµÄ´íÎóÂð£¿Ã÷Ã÷ÊÇÕÒ²»µ½Êý¾Ý¿â£¬È´±¨ÕÒ²»µ½±íµÄ´íÎó£¿
µ÷ÊÔ·¢ÏÖ£¬Ô­À´sqliteÔÚÕÒ²»µ½Êý¾Ý¿âµÄÇé¿öÏ»á×Ô¶¯½¨Ò»¸öеÄÊý¾Ý¿â£¨×¢£ºÎÒʹÓõÄÊÇsqlite.Data)
Ô­À´Èç´Ë£¬´íÎóÇåÎúÁË¡£
˳±ã½éÉÜÁ½¸ö¶«Î÷¸ø´ó¼ÒʹÓá£
System.Data.SQLite ......

SQLITEµÄ¾ÖÏÞÐÔ

SQLiteºÍÆäËû´ó²¿·ÖÏÖ´úSQLÊý¾Ý¿âÔÚ»ù±¾Éè¼ÆÄ¿±êÉÏÊDz»Í¬µÄ£¬ËüµÄÄ¿±êÊǼòµ¥¡£SQLite×ñÑ­ÕâһĿ±ê£¬¼´Ê¹ÕâÑùż¶û»áµ¼ÖÂijЩÌØÐÔʵÏֵĵÍЧ»¯¡£ÏÂÃæÁоÙÁËSQLiteµÄһЩȱÏÝ£º
SQL-92ÌØÐÔ·½Ãæ
ÕýÈçÇ°ÃæÌáµ½µÄ£¬SQLite²»Ö§³ÖSQL-92µÄÔںܶàÆóÒµÊý¾Ý¿âϵͳÖпÉÓõÄһЩÌØÐÔ¡£
È磺
Íâ¼üÔ¼Êø£¨¿É½âÎöµÄ£¬µ«·ÇÇ¿ÖÆ£©
ºÜ¶àALTER TABLEÌØÐÔ
һЩTRIGGERÏà¹ØµÄÌØÐÔ
RIGHTºÍFULL OUTER JOIN
¸üÐÂÒ»¸öVIEW
GRANTºÍREVOKE
Äã¿ÉÒÔÔÚSQLiteµÄÖ÷Ò³ÉÏ»ñÈ¡×îÐÂÐÅÏ¢¡£
http://www.sqlite.org/omitted.html
http://www.sqlite.org/cvstrac/wiki?p=UnsupportedSql
µÍ²¢·¢²Ù×÷
SQLiteÖ»Ö§³ÖƽÃæÊÂÎñ£»ËüûÓÐǶÌ׺ÍÓª¾ÈµãÄÜÁ¦¡£Ç¶Ì×Òâζ×ÅÔÚÒ»¸öÊÂÎñÖпÉÒÔÓÐ×ÓÊÂÎñµÄÄÜÁ¦¡£Óª¾ÈµãÔÊÐíÒ»¸öÊÂÎñ·µ»Øµ½Ç°ÃæÒѾ­µ½´ïµÄ״̬¡£ËüûÓÐÄÜÁ¦È·±£¸ß²ã´ÎÊÂÎñµÄ²¢·¢¡£ËüÔÊÐíÔÚµ¥¸öµÄÊý¾Ý¿âÎļþÉ϶à¸ö²¢·¢µÄ¶ÁÊÂÎñ£¬µ«ÊÇÖ»ÄÜÓÐÒ»¸öÅÅËûµÄдÊÂÎñ¡£Õâ¸ö¾ÖÏÞÐÔÒâζ×ÅÈç¹ûÓÐÊÂÎñÔÚ¶ÁÊý¾Ý¿âÎļþµÄÒ»²¿·Ö£¬ËùÓÐÆäËûµÄÊÂÎñ½«±»½ûֹд¸ÃÎļþµÄÈκÎÒ»²¿·Ö¡£ÀàËƵģ¬Èç¹ûÓÐÊÂÎñÔÚдÊý¾Ý¿âÎļþµÄÒ»²¿·Ö£¬ËùÓÐÆäËûÊÂÎñ½«±»½ûÖ¹¶Á»òÕßд¸ÃÎļþµÄÈκÎÒ»²¿·Ö¡£
Ó¦ÓÃÏÞÖÆ
ÒòΪËüÊÂÎñ´¦ÀíµÄÓÐÏÞ²¢·¢£¬SQLiteÖ»Éó¤´ ......
×ܼǼÊý:155; ×ÜÒ³Êý:26; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [17] [18] [19] [20] [21] [22] [23] 24 [25] [26]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ