Hi,
I'm facing a problem to make a DBFunctionCall during an insert in the database.
I want to fill fields "CreationDate" and "LastModDate" by the system date of the server side (by calling the function GETSYSDATE).
The problem is that I can't make the function call in one time. I have to write the element first by an INSERT without two fields and after that, to make an UPDATE with the function call for my two fields.
If I make the query in one call, two fields are not filled by the system date (they stay empty).
Here is my working code :
pEnt.Status = proBE.StatusOfProcess;
pEnt.Version = proBE.Version;
pEnt.InUse = proBE.InUse;
pEnt.Substance = sEnt;
adapter.SaveEntity(pEnt, true).
pEnt.Fields["CreationDate"].ExpressionToApply = new DbFunctionCall("GETSYSDATE", null);
pEnt.Fields["CreationDate"].IsChanged = true;
pEnt.Fields["LastModDate"].ExpressionToApply = new DbFunctionCall("GETSYSDATE", null);
pEnt.Fields["LastModDate"].IsChanged = true;
pEnt.IsDirty = true;
adapter.SaveEntity(pEnt, true).
That I want (or equivalent) is :
pEnt.Status = proBE.StatusOfProcess;
pEnt.Version = proBE.Version;
pEnt.InUse = proBE.InUse;
pEnt.Substance = sEnt;
pEnt.Fields["CreationDate"].ExpressionToApply = new DbFunctionCall("GETSYSDATE", null);
pEnt.Fields["CreationDate"].IsChanged = true;
pEnt.Fields["LastModDate"].ExpressionToApply = new DbFunctionCall("GETSYSDATE", null);
pEnt.Fields["LastModDate"].IsChanged = true;
pEnt.IsDirty = true;
adapter.SaveEntity(pEnt, true).
How can I make that?
Thank you for your help.