I have two Tables, the first one is :
CREATE TABLE `Material_Type` (
`Material_Type_ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT,
`Material_Type` nvarchar NOT NULL,
`Material_Type_Description` nvarchar
);
and the second Table is :
CREATE TABLE `Material` (
`Material_ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT,
`Material_Name` nvarchar NOT NULL,
`Material_Description` nvarchar,
`Material_Picture` BLOB,
`Material_Type_ID` integer NOT NULL,
FOREIGN KEY(`Material_Type_ID`) REFERENCES `Material_Type`(`Material_Type_ID`)
);
My problem is that when I add Insert a Material_Type_ID to the Material Table, Sqlite doesn't check the violation of the foreign key. for example I have
Material_Type_ID Material_Type Material_Descriptio 1 first material first description 2 2nd Mmaterial 2nd description
when I insert 20 in Material(Material_Type_ID) that doesn't generate any error. I set PRAGMA foreign_keys = OFF;but nothing changed can you help me to set this verification please ? Thanks in advance
Aucun commentaire:
Enregistrer un commentaire