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

Discussion in 'ASP .Net' started by bazzer, Apr 6, 2006.

  1. bazzer

    bazzer Guest

    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?
     
    bazzer, Apr 6, 2006
    #1
    1. Advertising

  2. RE: Failed to enable constraints. One or more rows contain values viol

    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.

    "bazzer" wrote:

    > 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?
    >
    >
     
    =?Utf-8?B?Y2xpY2tvbg==?=, Apr 6, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. H5N1
    Replies:
    0
    Views:
    449
  2. Jeff
    Replies:
    2
    Views:
    466
  3. Bobby Edward
    Replies:
    1
    Views:
    4,569
  4. Bobby Edward
    Replies:
    4
    Views:
    7,720
    sloan
    Nov 3, 2008
  5. cs_in_va

    Failed to enable constraints

    cs_in_va, Feb 19, 2008, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    180
    Mr. Arnold
    Feb 19, 2008
Loading...

Share This Page