I'm new in C# and I need some help.
I just want to update row in Session table by code below.
dbDataSet db = new dbDataSet();
SessionTableAdapter sessionTableAdapter = new SessionTableAdapter();
sessionTableAdapter.Fill(db.Session);
var session = db.Session.Where(s => s.idSession.Equals(new Guid("{0F0B0E1A-950E-4BCE-9C68-6D1387EDAC90}"))).SingleOrDefault();
session.endTime = DateTime.Now;
sessionTableAdapter.Update(db.Session);
I got an error at "sessionTableAdapter.Update(db.Session)"
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll
Additional information: The record cannot be deleted or changed because table 'PaidLog' includes related records.
How to fix this error ?
Solved !
At first that I just only tick Enforce Referential Integrity.
But I try to tick Cascade Update Related Fields and It's works !
I don't know why it work.
Anyone know the reason about this thing?
By the way, thanks to Maheep.