2013-03-10 175 views
0

我試圖從Web服務獲取插入的記錄ID後,Web方法做插入 但它沒有ID即使插入進行得很好 所以我怎麼能得到Web服務中的ID,如果我們知道的方式其返回的ID在網絡服務,但插入方法返回布爾 當我去我的應用程序仍然空如何獲取Web服務中最後插入的記錄ID

if (ExecuteSqlCommand(Comm) > 0) 
     { 
      result = true; 
      Obj.CUSTOMER_BANK_ACC_ID = (decimal)Comm.Parameters["p_CUSTOMER_BANK_ACC_ID"].Value; 
     } 
     return result; 
+2

如果Web服務有ID,它需要的Web應用程序傳遞迴的部分來自Web服務調用的有效負載。聽起來像Web服務沒有這樣做。 – 2013-03-10 15:18:08

+0

爲什麼我無法返回傳入對象中的ID? – 2013-03-11 07:31:05

回答

1

我得到了它的傢伙 如果你想要在傳遞的對象 中阻礙的Web服務內返回插入的記錄ID只是通過ref傳遞對象,並且這裏t他的代碼

Web服務功能

public bool AddObject(ref T_COMN_CUSTOMER_BANK_ACC_Entity Obj) 
    { 
     bool result = false; 
     OracleCommand Comm = new OracleCommand(InsertCommandName, Connection); 
     Comm.CommandType = CommandType.StoredProcedure; 
     Comm.Parameters.Add("p_CUSTOMER_ID", OracleType.Number).Value = Obj.CUSTOMER_ID; 
     Comm.Parameters.Add("p_CUSTOMER_TP_ID", OracleType.Number).Value = Obj.CUSTOMER_TP_ID; 
     Comm.Parameters.Add("p_CUSTOMER_BANK_ACC_ID", OracleType.Number).Direction = ParameterDirection.Output; 
     Comm.Parameters.Add("p_BANK_ID", OracleType.Number).Value = Obj.BANK_ID; 
     Comm.Parameters.Add("p_IBAN", OracleType.NVarChar, 200).Value = Obj.IBAN; 
     Comm.Parameters.Add("p_IS_DELETED", OracleType.Number).Value = Obj.IS_DELETED; 
     Comm.Parameters.Add("p_CREATED_BY", OracleType.NVarChar, 200).Value = Obj.CREATED_BY; 
     Comm.Parameters.Add("p_CREATED_DT", OracleType.DateTime).Value = Obj.CREATED_DT; 
     Comm.Parameters.Add("p_MODIFIED_BY", OracleType.NVarChar, 200).Value = Obj.MODIFIED_BY; 
     Comm.Parameters.Add("p_MODIFIED_DT", OracleType.DateTime).Value = Obj.MODIFIED_DT; 
     if (ExecuteSqlCommand(Comm) > 0) 
     { 
      result = true; 
      Obj.CUSTOMER_BANK_ACC_ID = (decimal)Comm.Parameters["p_CUSTOMER_BANK_ACC_ID"].Value; 
     } 
     return result; 
    } 

,我把它稱爲在這樣的

pers.AddObject(ref Customer_Bank_Acc_Obj); 
相關問題