object reference not set to an instance of an object on SubmitChanges()
Posted: Fri 28 Sep 2018 19:08
I´m using LinqConnect 4.4.727 for PostgreSql.
My code reads some entities (Clerk, in this case) from database, and the tries to delete one of them.
The code (as usual) is DataContext.Clerks.DeleteOnSubmit(this);
"This" is an instance read from the previous query.
When I execute DataContext.SubmitChanges() thru the following method (in a partial class file)
it returns false, and set the error string to the outer exception "object reference not set to an instance of an object". No more info regarding which object was null, etc
Of course, I can insert and update without trouble.
What could be going?
TIA
My code reads some entities (Clerk, in this case) from database, and the tries to delete one of them.
The code (as usual) is DataContext.Clerks.DeleteOnSubmit(this);
"This" is an instance read from the previous query.
When I execute DataContext.SubmitChanges() thru the following method (in a partial class file)
Code: Select all
public bool SendChanges( out string why)
{
bool result = true;
why = String.Empty;
try {
SubmitChanges();
}
catch (Exception e) {
why = e.Message;
if (e.InnerException != null)
why = String.Format("{0} - {1}", e.Message, e.InnerException.Message);
result = false;
}
return result;
}
Of course, I can insert and update without trouble.
What could be going?
TIA