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!!