Can someone tell me why my dataset wont save correctly to the database in simple winforms app?
- by Mike
I have been struggling with this all day and I know it is probably something stupid. My code is below. If I call save then exit my program and start again I can save images to my events but if I just call save when I try to add an image and call save again I get a foreign key error. From what I know I thought my save method was updating the database from my dataset so the event associated with the image should exist. Anyway here is my save method...
Private Sub Save()
Me.Validate()
EventsBindingSource.EndEdit()
ImagesBindingSource.EndEdit()
TableAdapterManager.UpdateAll(EventDataSet)
EventDataSet.AcceptChanges()
End Sub
Am I doing this wrong? Is this enough detail?