On 14 Mar 2012, at 7:11am, Pawl <[email protected]> wrote:

> I have this tables:
> 
> #1:
> 
> CREATE TABLE [mat] (
>  [ID_MAT] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 
>  [kod] TEXT, 
>  [popis] TEXT UNIQUE, 
>  [dilu_aktual] INTEGER, 
>  [dilu_aktualmax] INTEGER);
> 
> #2:
> CREATE TABLE [mat_spoj] (
>  [ID_VYROBEK] INTEGER NOT NULL REFERENCES [vyroba]([ID_VYROBA]), 
>  [ID_MAT] INTEGER NOT NULL REFERENCES [mat]([ID_MAT]), 
>  [dilu_max] INTEGER, 
>  [sarze] TEXT, 
>  [dilu_stitek] INTEGER, 
>  [POZICE] TEXT, 
>  [ghp_stav] INTEGER);
> 
> I use SQL Little Express Personal - when I try to delete used row in table
> "mat" i get error message 
> Abort due to constraint violation. - Helped by command DELETE from mat WHERE
> ID_MAT=3

This is correct.  Every mat_spo belongs to a mat.  You are trying to delete a 
mat which still has at least one mat_spo.

> When I try to make in my application 
> 
> cmd = new SQLiteCommand("DELETE from mat WHERE ID_MAT=3",parent.conn);        
>     
> cmd.ExecuteNonQuery(); 
> =>SQL Delete this row! without any problem. 

Your own application is faulty.  It is using a database with FOREIGN KEYs 
without enabling foreign key support.  Please see

<http://sqlite.org/foreignkeys.html#fk_enable>

Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to