我有这些表格:
TABLE_DIRECTOR
-directorID
-name
-adres
-birthDate
-yearsExperience
TABLE_FILM
-filmID
-directorID
-filmstudioID
-title
-budget
-filmstudioName
-directorName
TABLE_FILMSTUDIO
-filmstudioID
-name
-website
-foundingDate
-numberOfBuildings
我要做的就是用detailsview
填充所有filmdirectors
。我还有一个gridview
,其中包含filmstudio
所使用的所有directors
个。
要填写此gridview
我已将以下代码放入TABLE_FLMSTUDIO_TABLEADAPTER
:
SELECT TABLE_FILMSTUDIO.filmstudioID, TABLE_FILMSTUDIO.name,
TABLE_FILMSTUDIO.website, TABLE_FILMSTUDIO.foundingDate,
TABLE_FILMSTUDIO.numberOfBuildings
FROM TABLE_FILMSTUDIO INNER JOIN
TABLE_FILM ON TABLE_FILMSTUDIO.filmstudioID = TABLE_FILM.filmstudioID
WHERE (TABLE_FILM.directorID = @directorID)
但是,当我运行页面时,这会给我以下错误
Failed to enable constraints. One or more rows contain values
violating non-null, unique, or foreign-key constraints.
有人有想法吗?
答案 0 :(得分:1)
第一件事:TABLE_FILM -filmID -directorID -title -budget -filmstudioName -directorName不包含 filmstudioID但你在INNER JOIN中使用它作为TABLE_FILM.filmstudioID。
其次,错误表明您的某个表包含重复数据。 (违反外键)