一般我们在数据库中表示是否发布,是否审核等信息时,会用int来表示,但我们读出后要转换成审核通过,审核不通过,未发布,已发布等,一种方法就是将int值读出,然后在判断int的值,根据值在进行判断是审核通过,审核不通过,未发布,已发布;另一种方法就是直接在SQL语句中加上判断:
select ID,(case isnull(PAuditing,'') when 0 then '<font style=color:red;>未审核</font>' when 1 then '<font style=color:green;>审核通过</font>' when 2 then '<font style=color:pink;>审核不通过</font>' end) as Auding ,(case isnull(PPuber,'') when 0 then '<font style=color:red;>未发布</font>'else '<font style=color:pink;>已发布</font>' end) as PPuber from PEOPLEINFO 同时还可以个文字加颜色<font style=color:green;>审核通过</font>,审核通过就显示绿色。这种方法可以减少代码的编写。可以尝试一下。