Exemplo n.º 1
0
 /// <summary>
 /// 新增数据到数据库中
 /// </summary>
 /// <param name="pDTInfo"></param>
 /// <returns></returns>
 public Common.CResultInfo Add(System.Data.DataTable pDTInfo)
 {
     Common.CResultInfo pResultInfo = new Common.CResultInfo();;
     try
     {
         string sParentID = pDTInfo.Rows[0][base.TableCode + ".vParentID"].ToString();
         pResultInfo = base.Add(pDTInfo);
         if (pResultInfo.bSuccess == false)
         {
             return(pResultInfo);
         }
         if (sParentID.Trim() != "")
         {
             Cnwit.Utility.DataAcess pDataAccess = Common.GetProjectDataAcess.GetDataAcess();
             pDataAccess.scExecuteQuery("update " + base.TableCode + " set bChildFlag = 0 where vID = '" + sParentID + "';update " + base.TableCode + " set vParentID = '" + sParentID + "' where vID = '" + pDTInfo.Rows[0][base.TableCode + ".vID"].ToString() + "'");
             return(pResultInfo);
         }
     }
     catch (System.Data.SqlClient.SqlException sqlErr)
     {
         pResultInfo.bSuccess = false;
         pResultInfo.ErrorID  = sqlErr.Number.ToString();
     }
     catch (System.Exception err)
     {
         pResultInfo.bSuccess  = false;
         pResultInfo.ErrorDesc = err.Message;
     }
     return(pResultInfo);
 }