我工作的地方有这个函数插入一个对象信息到数据库,它返回插入时创建的ID,但.. ..他们有这个函数作为布尔返回,它是否能够提交或不提交。我希望能够使用它返回的ID,但我不知道如何访问它,它将它分配给实体,但该函数返回一个布尔值..所以它有点令人困惑......我怎样才能获得从我的情况sp返回的ID
//HERE IT IS SAVING THE ID INTO THE ENTITY BUT I AM NOT SURE HOW TO ACCESS IT ?.
myentity.ObservationID = (System.Int32)_observationID;
myentity.AcceptChanges();
OnDataRequested(new CommandEventArgs(commandWrapper, "Insert", entity));
return Convert.ToBoolean(res);
在提交按钮,它也会做这样的
bool observationInserted = false;
observationInserted = observationAdmin.Insert(observationEntity);
if(observationInserted)
{
I need to grab the observation id that was saved, the code in the inserting function seems
to be doing this but it returns boolean, I need the ID and the boolean.
then it will navigate somewhere appending the id.
}
NoteL东西插入在通话结束后,提交按钮它进入某种交易认证管理器,并从那里然后调用与插入功能交易结果。
是不是你正在寻找保存在您传递的实体对象的ID?如果是这样,你不只是需要阅读observationEntity.ObservationID? – Strillo 2012-01-26 23:02:06