Hi vbforums users!!
I have the following code:
in the field: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()
works great, but in the other 2 cases:Code:myDA.Fill(myDS, "productsold")andCode:myDA.Fill(myDS, "BillInfo")say me that Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.Code:myDA.Fill(myDS, "customer")
My database inwont have Primary Key, but in the other 2 cases I have a primary Key.. any idea to fix this?Code:myDA.Fill(myDS, "productsold")
I have VisualStudio 2010 + MySQL
Best Regards!!



Reply With Quote
