数据库查询到的Name有空的,怎么用Replace变成【null name】

解决方案 »

  1.   

    就是显示到下拉列表的时候是显示【null name】,而不是空白
      

  2.   

    对其进行处理,假设结果字符串为string result
    if(string.IsNullOrEmpty(result))
        result="【null name】";
        
      

  3.   

    if(DataTables.Rows[0]["Name"] == DBNull.Value) //客户端
    {}select (case when isnull(name,'1') then 'null name' else name end) as name from tablename   //sql 
      

  4.   

    if(DataTables.Rows[0]["Name"] == DBNull.Value) //客户端
    {}select (case when isnull(name,'1')='1' then 'null name' else name end) as name from tablename //sql 
      

  5.   

    select isnull(name,'【null name】') name from tableName