Insert/Update issue

Insert/Update issue

Old forum URL:

SteveA posted on Tuesday, November 02, 2010

I have a businessbase object that I create with the data portal. I then set the properties equal to input values, then save it, and it runs the insert correctly. Next, I change a property again, then save again. It runs the insert again not the update. Is this how it is supposed to work? How do I make sure that after the object has been saved once it knows that now it should only do updates?

SteveA replied on Tuesday, November 02, 2010

in debugging I noticed that the insert method is correctly loading the ID property, but once it goes back to the page the objects ID property is set to 0. I cannot figure out why the ID is getting lost.

JonnyBee replied on Tuesday, November 02, 2010

The Save method actually returns a new object so your code should look like:

rootBO = rootBO.Save();

The returned object is marked as "Old" and next save will be an Update.

dlucid replied on Tuesday, May 08, 2012

Also, if you you need the Id parameter from database.

If you are using stored procedure, make output parameter id, you need last inserted id.




Copyright (c) Marimer LLC