in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

FOREIGN KEY doesn't work at all in 3.6.16

Last post 03-03-2010 5:52 AM by bider79. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 03-02-2010 5:54 PM

    FOREIGN KEY doesn't work at all in 3.6.16

    CREATE TABLE [TB_User_GroupCalendar] (
    [UserID] int  NOT NULL,
    [GroupCalendarID] INT  NOT NULL,
    FOREIGN KEY(UserID) REFERENCES TB_User(ObjectID),
    FOREIGN KEY(GroupCalendarID) REFERENCES TB_GroupCalendar(ObjectID)

    )

    If I try to insert record with GroupCalendarID=777,  provided that no 777 exists in TB_GroupCalendar, I nevertheless, get my record inserted into TB_User_GroupCalendar. What I'm doing wrong and how to fix this?

    Filed under:
  • 03-03-2010 5:52 AM In reply to

    Re: FOREIGN KEY doesn't work at all in 3.6.16

     Sqlite does not have foreign key constraint support until 3.6.19.  You can enforce foreign key constraints prior to 3.6.19 via triggers.  Take a look at: http://www.sqlite.org/cvstrac/wiki?p=ForeignKeyTriggers

     Hope that helps!

Page 1 of 1 (2 items)
Powered by Community Server (Commercial Edition), by Telligent Systems