Results 1 to 2 of 2

Thread: Crystal Report: Failed to enable constraints. One or more rows contain values

Hybrid View

  1. #1

    Thread Starter
    Junior Member feroguz's Avatar
    Join Date
    Aug 2013
    Posts
    22

    Talking Crystal Report: Failed to enable constraints. One or more rows contain values

    Hi vbforums users!!

    I have the following code:

    Code:
      Dim rpt As New rptInvoice() 'Crear nuevo reporte
            Dim myConnection As MySqlConnection
            Dim MyCommand As New MySqlCommand()
            Dim myDA As New MySqlDataAdapter()
            Dim myDS As New timetracking2DataSet 'Dataset a modificar
    
    
    
            myConnection = New MySqlConnection("Data Source=xxxxx;Database=xxxxx;User ID=xxxx;Password=xxxxx;")
            MyCommand.Connection = myConnection
            'MyCommand.CommandText = "SELECT * FROM  BillInfo INNER JOIN ProductSold ON BillInfo.InvoiceNo = ProductSold.InvoiceNo INNER JOIN Customer ON BillInfo.CustomerNo = Customer.CustomerNo WHERE billinfo.invoiceno= '" & frmSales.txtInvoiceNo.Text & "'"
            MyCommand.CommandText = "SELECT * FROM  BillInfo INNER JOIN ProductSold ON BillInfo.InvoiceNo = ProductSold.InvoiceNo INNER JOIN Customer ON BillInfo.CustomerNo = Customer.CustomerNo WHERE billinfo.invoiceno= '" & frmSales.txtInvoiceNo.Text & "'"
            MyCommand.CommandType = CommandType.Text
            myDA.SelectCommand = MyCommand
            myDA.Fill(myDS, "BillInfo")
            myDA.Fill(myDS, "productsold")
            'myDA.Fill(myDS, "customer")
    
            rpt.SetDataSource(myDS)
            CrystalReportViewer1.ReportSource = rpt
            CrystalReportViewer1.RefreshReport()
            CrystalReportViewer1.Show()
    in the field:

    Code:
     myDA.Fill(myDS, "productsold")
    works great, but in the other 2 cases:
    Code:
     myDA.Fill(myDS, "BillInfo")
    and
    Code:
      myDA.Fill(myDS, "customer")
    say me that Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

    My database in
    Code:
    myDA.Fill(myDS, "productsold")
    wont have Primary Key, but in the other 2 cases I have a primary Key.. any idea to fix this?

    I have VisualStudio 2010 + MySQL
    Best Regards!!

  2. #2
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,206

    Re: Crystal Report: Failed to enable constraints. One or more rows contain values

    This has nothing to do with Crystal Reports. You should ask this question in VB .Net forum. That being said, the error message states what the problem is in general terms.
    One or more rows contain values violating non-null, unique, or foreign-key constraints.
    You need to check you tables for any of those problems. Look at what relations are setup between those tables. Check if there are any records in the child table that don't have a foreign key match in the parent table.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width