7/1/2025 5:34:33 PM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
|
|
|
|
Unexpected Row Count 0 : Expected 1
Posted: 07 Dec 09 3:45 PM
|
Hi
Has anyone any ideas on this error.
When I save an existing contact from the contact details screen I get the error:
StaleStateException Unexpected Row Count 0 : Expected 1
This is occurring when I make no changes to the form. If I make a change to the phone fields I don't get the error.
After dismissing the exception, when I click save it saves correctly. This seems to be localised to contacts that already existed, on the database.
Does anyone have any ideas as to what the problem is? Or alternatively how I can interrogate the exception to find which row it is complaining about?
Here is the code the exception is produced in, after Session.Flush();
Thanks
ISession session = SessionFactoryHolder.HolderInstance.CreateSession(); try { if (PersistentState == PersistentState.Modified) { _OnBeforeUpdate(this, session); } #region 1:1 extension update handlers if (ContactExtra.PersistentState == PersistentState.Modified) { Sage.SalesLogix.Entities.ContactExtra._OnBeforeUpdate(ContactExtra, session); } if (ContactPermission.PersistentState == PersistentState.Modified) { Sage.SalesLogix.Entities.ContactPermission._OnBeforeUpdate(ContactPermission, session); } #endregion 1:1 extension update handlers if ((PersistentState & PersistentState.New) == PersistentState.New) { session.Save(this); } else { session.Update(this); } _LastPersistedOwner = _Owner; session.Flush(); PersistentState = PersistentState.Unmodified; OnPersisted(); ClearChanges(); } finally { SessionFactoryHolder.HolderInstance.ReleaseSession(session); } |
|
|
|
Re: Unexpected Row Count 0 : Expected 1
Posted: 07 Dec 09 4:48 PM
|
I recall running into similar issues in the past.
Make sure that: - Your Contacts have valid addresses (AddressID and ShippingID, and that the addressses do exist) - Your Contacts have valid Owners and Account Managers (I have seen cases where the UserID no longer exists, or the Owner (a deleted team) and that causes problems with the data)
That may also be why the problem occurs with existing data and not with newly created records. Maybe consider running the the Integrity checker as well.
If all fails to fix, go ahead and run the SLX Profiler. Look for related queries that return 0 rows and try and determine if they should've at least returned 1 row... |
|
|
|
Re: Unexpected Row Count 0 : Expected 1
Posted: 08 Dec 09 6:32 AM
|
Thanks
The problem has now been solved, the problem was caused by a trigger on the contact_extra table that has now been disabled.
|
|
|
|
Re: Unexpected Row Count 0 : Expected 1
Posted: 08 Dec 09 9:19 AM
|
Well, you are have way there, you identified the problem.
Here is the solution, in order to keep the trigger working:
Make sure to set the NOCOUNT option to on at the beggining of the trigger, and turning it off right before the end of the trigger: TRIGGER SET NOCOUNT ON ... HERE GOES MY TRIGGER CODE ... SET NOCOUNT OFF END TRIGGER |
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|