Are you sending the pragma to enable FK constraints?

   PRAGMA foreign_keys = ON;

see: http://www.sqlite.org/foreignkeys.html

Another option is to use triggers.

see: http://www.justatheory.com/computers/databases/sqlite/foreign_key_triggers.html

HTH,

Al

-----Original Message-----
From: Greg Keogh
Sent: 5/27/2011 11:43 PM

Folks, today I've returned to experimenting with the SQLite ADO.NET provider 1.0.66.0. Months ago I evaluated SQLite and got stuck with problems on DateTime fields, Guids and default values. But I'm back into it with a fresh mind and I'm migrating some SQL Server Express data into equivalent SQLite tables for experiments with EF4 and SQLite.

I was surprised to find that I could insert FK values into a table that break referential integrity. Web searches produce conflicting comments on this. Many pages say that SQLite does not enforce FK integrity, but this page <http://www.sqlite.org/foreignkeys.html> from sqlite.org has an example where an insert fails.

SQLZoo.net <http://sqlzoo.net/howto/source/u.cgi/tip241028/sqlite> says:

/Specific to SQLite/

The relationship between the tables is not enforced

So what's the truth on this?

Greg


Reply via email to