The error states:
Error in [dbo].[PrescriptionPamflet_modified] trigger. An error was raised during trigger execution. The batch has been aborted and the user transaction, if any, has been rolled back.
I have the following DevExpress grid:
When I press the Print button it should update the database values and print a report.
When there are no changes to update, everything works fine.
Note: I use LINQ to set the datasource of the grid and inPatientID
is the primary key variable I use to determine which patient I am working with. myDB
is my DataContext
Note: the grid's datasource comes from BindingSourcePrescriptionItems
Here is the code I call to load the data:
Dim patientPrescriptions = From prescription In myDB.PrescriptionPamflets
Where prescription.PatientID = inPatientID
Select prescription
BindingSourcePrescriptionItems.DataSource = patientPrescriptions
And this is the code for the Print Button:
BindingSourcePrescriptionItems.EndEdit()
GridViewPerscriptionPamflet.PostEditor()
Try
myDB.SubmitChanges()
Catch ex As Exception
DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message.ToString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
Dim rpt As New XtraReportPrescriptionPamflet(inPatientID)
rpt.ShowPreview()
rpt.BringToFront()
Note: only the PackSize
and Quantity
columns are editable as you can't/shouldn't update primary and foreign key values.
Also the data type for PackSize
is decimal
and the data type for Quantity
is integer
on the grid as well as the SQL Server database itself.
Any help will be appreciated. The few results I have found online states that it is a datatype mismatch but my datatypes match perfectly. I don't want to use SQL to update the database as our company is moving over to use LINQ for everything.
There were double triggers created. I deleted them all. Dropped the table and created it again. Fixed my issue and have not had it since.