Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign

B

bazzer

i have a webform which is connecting to a microsoft access database.
the database contains info about dates and times of films showing in
cinemas. im trying to get the times of a certain film from a certain
cinema on a certain date. this is the sql in my data adapter:

SELECT FilmDetails.cinemaID, Shows.showTime, FilmDetails.filmID,
Shows.showDate
FROM (FilmDetails INNER JOIN
Shows ON FilmDetails.filmID = Shows.filmID)
WHERE (FilmDetails.cinemaID = ?) AND (Shows.showTime = ?) AND
(FilmDetails.filmID = ?)

and this is the code on my webform:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
Label4.Text = Session("theCinemaName")
Label6.Text = Session("theFilmName")
Label8.Text = Session("theShowDate")

FilmTimesDataSet1.Clear()
OdbcDataAdapter1.SelectCommand.Parameters("cinemaID").Value
= Session("theCinemaID")
OdbcDataAdapter1.SelectCommand.Parameters("filmID").Value =
Session("theFilmID")
OdbcDataAdapter1.SelectCommand.Parameters("showDate").Value
= Session("theShowDate")
OdbcDataAdapter1.Fill(FilmTimesDataSet1)
ListBox1.DataBind()
End If
End Sub

i get an error though from "OdbcDataAdapter1.Fill(FilmTimesDataSet1)":

Failed to enable constraints. One or more rows contain values violating
non-null, unique, or foreign-key constraints.

can anyone give me an idea of how to fix this error or what exactly is
causing it?
 
G

Guest

Have you tried running the query in access and seeing whether it gives you
the rows you want. Also try replacing the parameters with actual valid
values to see if that will run OK.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top