我有一个table_Project,其中包含CustomerID(链接到tbl_Customer).在tbl_Customer中,我有Customer_ID(作为密钥)和其他一些信息,如电话,电子邮件等.
要从Gridview中删除它,我使用此DeleteCommand:
DeleteCommand="DELETE FROM [tbl_Customer] WHERE [Customer_ID] = @Customer_ID"
Run Code Online (Sandbox Code Playgroud)
但它给了我以下错误:
The DELETE statement conflicted with the REFERENCE constraint "Klant_Relatie". The conflict occurred in database "Database_1", table "dbo.tbl_Project", column 'CustomerID'.
The statement has been terminated.
但是通过更新CustomerInfo,我没有收到任何错误.我已经看到了C#的不同解决方案,但我使用.net
有任何想法吗?