oracle数据库处理DBNULL并进行替换

public static  class ConvertExt
    {

      /// 
        /// NULL 处理、替换
      /// 
      public static string ReplaceExt(this string obj,string oldStr,object newObj)
      { 
          //检查要替换的新内容是否为空
          string newStr = newObj == null ? string.Empty : (newObj != DBNull.Value ? newObj.ToString() : string.Empty);

          return obj.Replace(oldStr,newStr);
      }
  

 

你可能感兴趣的:(.net)