SqliteºÍSQLCEÔÚWindows Mobile 6ÉϵÄÐÔÄܶԱÈ
×î½ü¹«Ë¾ÐèÒª½«×ÀÃæϵͳ²¿Êðµ½PDAÉÏÃæÈ¥£¬Ñ¡ÔñÁËWM6×÷Ϊ²¿Êðƽ̨¡£ÔÚÑ¡ÔñÊý¾Ý¿â·½Ãæ³öÏÖÁËÒ»µã¹ËÂÇ£¬ÒòΪ¶ÔÓÚPDA¶øÑÔ£¬ÐÔÄÜÊÇÊ×Òª¿¼ÂǵÄÒòËØ¡£
ÔÚ¿ªÔ´µÄÊý¾Ý¿âSqliteºÍSQLCEÖ®¼äÅÇ»²£¬ËùÒÔÕë¶ÔÕâ¸öÇé¿ö£¬¶ÔSqliteºÍSQLCEÔÚWM6ÉÏÃæ×öÁËÐÔÄܲâÊÔ¡£ÎÒÒ²½«×Ô¼ºÔÚ×ö²âÊÔ¹ý³ÌÖÐÅöµ½µÄÎÊÌâÔÚÕâÀïÂÞÁÐһϣ¬ÒÔ±ãÈÃÄÇЩÔÚÍøÉϲéÁ˺ܾö¼ÕÒ²»µ½´ð°¸µÄÅóÓÑÉÙ×ßһЩÍä·¡£
´ÓÁ½¸ö·½ÃæÀ´·ÖÎö£ºµÚÒ»£¬Åöµ½µÄÎÊÌâÒÔ¼°½â¾ö·½°¸£¬µÚ¶þ£¬²âÊÔÐÔÄܵĽá¹ûºÍ½áÂÛ¡£
µÚÒ»£ºÊ×ÏÈÔÚ²¿ÊðµÄʱºòÐèÒª½«Êý¾Ý¿â¿½±´µ½PDAÉÏ»òÕßWMÉÏÃ棬¿½±´µÄ·¾¶ÊÇÔÚ³ÌÐòÖÐдºÃµÄ·¾¶¡£²âÊÔʱ£¬Îҵķ¾¶ÊÇ"Program Files"smartdevicetestÏÂÃæ¡£
¿ªÊ¼²¿Êðʱ£¬ÒòΪÎÒÏȲâÊÔSQLCEµÄ£¬³öÏÖ “ÎÞ·¨ÕÒµ½ PInvoke DLL“sqlceme35.dll” ”µÄ´íÎó£¬ÔÒòÊÇÒòΪÔÚVS×Ô¶¯²¿ÊðµÄʱºòûÓн«sqlceme35.dll²¿Êðµ½Ä£ÄâÆ÷ÉÏÃæÈ¥£¬µ¼Ö±àÒëͨ¹ý£¬µ«ÊÇÔËÐгö´í¡£
ÔÚÍøÉÏÕÒÁËЩ½â¾ö·½°¸£¬ºÜ¶à²»ÄÜÓã¬ÒÔϽâ¾ö·½°¸ÄÜÐУºhttp://blog.csdn.net/flyjimi/archive/2008/12/11/3500606.aspx ÔÎĵØÖ·ÊÇ£ºhttp://blogs.msdn.com/sqlservercompact/archive/2007/10/26/can-t-find-p-invoke-dll-sqlcemenn-dll.aspx µ«ÊÇÔÚ½â¾ö·½°¸ÖУ¬Ã»ÓÐдÃ÷°×¾ßÌåµÄ²Ù×÷·½·¨£¬¾ßÌåÊÇÄÄÈý¸öCABÎļþ¡£È»ºóÎҾ͵½ÒÔÏÂĿ¼ÏÂ
ÔÚÕâ¸öĿ¼ÏÂÓкܶà¸öCAB£¬ÒòΪÎÒÓõÄÊÇWM5µÄ£¬ËùÒÔ¹ØÓÚWM5µÄÎÒ¶¼¿½±´µ½Ä£ÄâÆ÷ÉÏÈ¥£¬ ½«Ñ¡ÖеÄÎļþ¿½±´µ½WM5ÉÏÃ棬Ȼºóµ½WMÉÏÃæÖ´ÐÐһϣ¬ÔÚÖ´ÐÐÕâЩÎļþµÄʱºò»á³öÏÖ“ÒѾ°²×°ÁË֮ǰµÄ°æ±¾£¬ÐèÒªÖØа²×°µÄµã»÷È·¶¨”¡£µã»÷È·¶¨¾ÍºÃÁË¡£Îҵݲװ˳ÐòÊÇ£º´ÓÏÂÍùÉÏÒÀ´Î°²×°¡£ÖØбàÒ룬²¿Êð£¬ÔËÐУ¬SQLCEͨ¹ý¡£
ÂÖµ½SQLiteÁË£¬»¹ÊÇ°´ÕÕÔÀ´Ò»Ñù½«Êý¾Ý¿â¿½±´µÄĿ¼ÏÂÃ棬ÕâÀïÊý¾Ý¿âÖ§³ÖµÄÀàÐÍÔÝʱÎÒÖªµÀÊÇÓГ.DB”£¬“.DB3”.ºóÀ´Í¨¹ýÓÃUltraEdit´ò¿ªSQLiteµÄÊý¾Ý¿â·¢ÏÖÀïÃæÓÐSQLite3µÄ¹Ø¼ü×Ö£¬ËùÒÔÖ»ÒªÓÐÕâ¸ö¹Ø¼ü×Ö£¬ºó׺Ãû²»¹ÜÓÃʲô¶¼ÊÇÖ§³ÖµÄ¡£Ã»Óкó׺ÃûÒ²ÊÇ¿ÉÒԵġ£
»¹ÊÇ°´ÔÀ´µÄÒ»Ñù¡£²¿ÊðÔËÐУ¬³öÏÖÁË“ÎÞ·¨ÕÒµ½ PInvoke DLL 'SQLite.Interop.064.DLL'”ÔÒòµ±È»Ò²ÊÇVS²¿ÊðµÄʱºò²»»á½«Õâ¸ö²¿ÊðÉÏÈ¥¡£ÓôÃÆ£¬Ã»ÓÐÏÈÀýµÄ¶«Î÷¾ÍÊÇÎÊÌâ¶à¡£Ã»°ì·¨£¬Ö»Óг¢ÊÔ¡£ÕÒµ½SQLite.netµÄ°²×°Ä¿Â¼Ï¡£
Ïà¹ØÎĵµ£º
1¡£´Ówww.sqlite.orgÏÂÔØSQLite 3.3.4µÄ°æ±¾
ΪÁË·½±ã£¬ÎÒ°ÑËü½âѹÁË£¬¾ÍÒ»¸öSQLite3.exe£¬·ÅÈëWindowsĿ¼Ï¡£
Cmd ½øÈëÃüÁîÐÐ
1)
´´½¨Êý¾Ý¿âÎļþ:
>SQLite3 d:\test.db »Ø³µ
¾ÍÉú³ÉÁËÒ»¸ötest.dbÔÚdÅÌ¡£
ÕâÑùͬʱҲSQLite3¹ÒÉÏÁËÕâ¸ötest.db
2)
ÓÃ.help¿ÉÒÔ¿´¿´ÓÐʲôÃüÁî
>.help »Ø³µ¼´¿É
3)¿ÉÒ ......
´ÓÍøÉÏÕÒµÄÀý×Ó£¬´´½¨ÁËÒ»¸öÊý¾Ý¿â£¬×·¼ÓÁ˼¸Ìõ¼Ç¼ºó£¬È»ºó¹Ø±ÕÊý¾Ý¿â£¬È»ºó×¼±¸ÏòPDAÏÂÔØÊý¾Ý¿â£¬·¢ÏÖÎļþ¾¹È»±»Õ¼ÓÃÁË£¬ÒѾ¹Ø±ÕÁËÊý¾Ý¿âÁ¬½ÓÒ²ÎÞЧ£¬ºóÀ´´ÓÍøÉÏ¿´µ½ÐèÒªÇå³ýÁ¬½Ó³Ø
using (SQLiteConnection cn = new SQLiteConnection("Data Source=" + strTempPath + "\\Smoke.db3;Pooling=true;FailIfMissing=false ......
SQLite°üº¬ÁËÈçÏÂʱ¼ä/ÈÕÆÚº¯Êý£º
datetime().......................²úÉúÈÕÆÚºÍʱ¼ä
date()...........................²úÉúÈÕÆÚ
time()...........................²úÉúʱ¼ä
strftime().......................¶ÔÒÔÉÏÈý¸öº¯Êý²úÉúµÄÈÕÆÚºÍʱ¼ä½øÐиñʽ»¯
datetime()µÄÓ÷¨ÊÇ£ºdatetime(ÈÕÆÚ/ʱ¼ä,ÐÞÕý·û,ÐÞÕý·û...)
......
backup ?DB? FILE ±¸·ÝÊý¾Ý¿âµ½Îļþ£¬Ä¬Èϱ¸·ÝµÄÊÇmainÊý¾Ý¿â,Èç¹û²»¸½¼ÓÊý¾Ý¿â£¬test.dbÎļþÖÐĬÈϵÄÖ»ÓÐmainÊý¾Ý¿â¡£ ÃüÁî²Ù×÷¾ÙÀý£º
sqlite> .backup mydb.bak
sqlite>
´Ëʱ¿ÉÒÔÔÙFÅÌ¿´µ½mydb.bakÎļþ£¬ÓüÇʱ¾´ò¿ªËäÈ»ÊÇÂÒÂ룬µ«¿É¿ú¼ûÒ»°ß¡£
.restore ?DB? FILE ´Ó±¸·ÝÎļþ»¹ÔÊý¾ÝºÍ.backupÏà¶ÔÓ¦. ½ÓÉÏ ......
.nullvalue STRING ÓÃSTRING´úÌænullÖµÏÔʾ,²»ÄÑÀí½â£¬¾Í²»ÔÙÀÛÊöÁË¡£
.output FILENAME ÉèÖðѲéѯÊä³öµ½Îļþ,ºóÃæµÄÊä³ö½á¹û¶¼±£´æµ½ÎļþÖÐ,È磺
sqlite> .mode list
sqlite> .output websites.txt
sqlite> select * from websites;
sqlite>
¿ÉÒÔÔÚFÅÌÏ·¢ÏÖ½¨Á¢ÁËwebsites.txtÎļþ£¬ÆäÄÚÈÝÈçÏ£º
......