Last post Sep 21, 2009 07:36 AM by pbcclements
Sep 15, 2009 10:46 AM|pbcclements|LINK
Is it possible to get the value of the guid pk of a newly added record in dynamicdata without 'requerying' the database - the db record is created ok, but I'm not sure how to best get the allocated guid value. Thanks
Sep 15, 2009 11:21 AM|anfran.mendez|LINK
You have this option :-
or You can do this:-
Get the GUID before inserting into a variable. You can reuse that variable into inserting into the table pk field or if executing in an S.P, then u can return the value to the application
Sep 15, 2009 12:48 PM|pbcclements|LINK
Thanks Anfran - I was hoping that the new guid might be exposed in the dd table object, but it seems not.
Sep 15, 2009 02:57 PM|DaveRuss|LINK
What are you hoping to use the GUID for?
Are you using EF or L2S with DynamicData?
Is it generated by the database automatically, or via an SP or trigger?
Sep 16, 2009 12:43 PM|sjnaughton|LINK
Hi Pete, is the issue that you can't insert when using a GUID? if so I think I can help [:D]
Sep 21, 2009 07:36 AM|pbcclements|LINK
sorry for delay in my reply - I just really need the allocated guid to use elsewehere in the application follow on events - I have no problem creating the guid in the db, just would be nice to efficiently pick it up using th dd framework - at the moment
I requery the db after insert to pick up the allocated guid - not very efficient.