简单说下问题 举个例子
比如数据库有个表
字段名    A       B       C      D
         张三    男      asd     asd
         李四    女      null    dd前台想绑定个gridview显示以上数据  但前台内容有所不同 如:
       学生      性别      审核
       张三       男       合格
       李四       女       不合格问题是 前台的审核字段在数据库中是根据 c 和 d字段必须都不为null时显示文本"合格"2个字如果c和d有一个为null
就显示不合格2个字  请问gridview怎么绑定   在线等

解决方案 »

  1.   

    select A as 学生,B as 性别,审核=
                 case
                  when C is null then '不合格'
                  when D is null then '不合格'
                  else '合格'
    from 表
      

  2.   

    这应该是容易做到的!!
    在GridView的RowDataBind事件中进行
    将判断结果放在C列,将D列隐藏
    if(e.Row.Cells[2].Text!=" " & e.Row.Cells[3].Text!=" " )
            e.Row.Cells[3].Text="合格";
    else
            e.Row.Cells[3].Text="不合合格";
    e.Row.Cells[3].Visible=false;
      

  3.   

    这应该是容易做到的!! 
    在GridView的RowDataBind事件中进行 
    将判断结果放在C列,将D列隐藏 
    if(e.Row.Cells[2].Text!=" " & e.Row.Cells[3].Text!=" " ) 
            e.Row.Cells[2].Text="合格"; 
    else 
            e.Row.Cells[2].Text="不合合格"; 
    e.Row.Cells[3].Visible=false;