SQLiteÓô¥·¢Æ÷À´Ìæ´úÍâ¼üÔ¼Êø
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
) CREATE TABLE [Product] (
[Pkid] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
[CategoryPkid] INTEGER NOT NULL,
[ProductName] nvarchar(32) NULL,
[ProductPrice] NUMERIC(19,4) DEFAULT '0.00' NOT NULL
) --InsertÔ¼Êø
CREATE TRIGGER FK_Product_CategoryPkid_Insert
BEFORE Insert ON Product
FOR EACH ROW BEGIN
SELECT RAISE(ROLLBACK,'No this categoryPkid in category')
WHERE (SELECT Pkid from Category WHERE Pkid = NEW.CategoryPkid) IS NULL;
END --UpdateÔ¼Êø
CREATE TRIGGER FK_Product_CategoryPkid_Update
BEFORE Update ON Product
FOR EACH ROW BEGIN
SELECT RAISE(ROLLBACK,'No this categoryPkid in category')
WHERE (SELECT Pkid from Category WHERE Pkid = NEW.CategoryPkid) IS NULL;
END
Ïà¹ØÎĵµ£º
2010ÄêSQLiteѧϰ±Ê¼ÇÖ®Ò»
Ò»£® ÈçºÎ»ñÈ¡SQLite×îа汾
¹Ù·½Õ¾µã£ºhttp://www.sqlite.org/
´Óhttp://www.sqlite.org/ÍøÕ¾µÄDownloadÒ³Ãæ»ñÈ¡
¼´ÈçÏÂÒ³ÃæÏÂÔØ
http://www.sqlite.org/download.html
¶þ£®WindowsϵÄSQLiteµÄÔ´´úÂëÊÇÄĸöÈí¼þÑ¹Ë ......
»¹Êdzõ̽£¬×öµÄÏîÄ¿ÒªÓõ½ÇáÇɵı¾µØÊý¾Ý¿â£¬ÓÚÊÇÕÒÁË sqlite 3 ÊÔÓÃÖ®£¬»¹²»´í£¬¹»ÇáÇÉ¡£
ÉÏÕâ¶ùÈ¥ÏÂÔسÌÐòºÍ²é¿´Îĵµ£º http://www.sqlite.org/download.html
Õâ»Ø¿ª·¢ÓõÄÊÇ C#£¬ÓÚÊÇÕÒÁ˸ö.NETµÄ¿â Finisar.SQLite £¬µ½Õâ¶ùÈ¥ÔØ http://adodotnetsqlite.sourceforge.net/
Òª¼ÇµÄÒ²²»ÊÇʲô´ó²»Á˵Ķ«Î÷£¬Ê¾ÀýÍøÕ¾É϶ ......
//²åÈë¼°¸üвÙ×÷
int nRet = 0;
sqlite3 * db = NULL;
CString strFilePath; //Êý¾Ý¿â´æ´¢Â·¾¶
//·¾¶¸³Öµ£¨Ê¡ÂÔ£©
//Á¬½ÓÊý¾Ý¿â
nRet = sqlite3_open16(strFilePath, &db); //Óм¸¸ö´ò¿ªº¯Êý¿É¹©µ÷Óã¬Ê¹ÓÃWCHARÀàÐÍ·¾¶ÓÃÕâ¸ö
if(nRet != SQLIT ......
/*=================================
.* The Standard include file.
.*
.*===============================*/
#include <stdio.h>
#include <stdlib.h>
/*=================================
.*
.* The extend include file.
.*
.*===============================*/
#include "sqlit ......