数据库显示相关问题 [英] Database display related issue

查看:87
本文介绍了数据库显示相关问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尊敬的先生,

我有一个gridview控件,并且在数据库表中有一个名为attandence1,attandance2的字段,此表的字段中的值为0,1,2,其中0表示不存在,1表示存在,2表示不留,现在我要显示在grdiview控件中不存在0,依此类推.

怎么可能.
请帮我.
谢谢
Abhishek

解决方案

尝试一下.

 选择 案例 何时 attandence1 =  0   THEN  ' 缺席
            何时 attandence1 =  1   Then  ' 当前'
             ELSE  '  OnLeave'  END   AS  attandence1 来自表名


Respected Sir,

I have a gridview control and in database table there is a field named attandence1,attandance2 and in this table`s field the value is 0,1,2 where 0 represents absent and 1 represents present and 2 represents onleave,Now i want to display absent for 0 in grdiview control and so on.

How it is possible.
Pls help me out.
Thanks
Abhishek

解决方案

Try this.

select CASE WHEN attandence1 = 0  THEN 'Absent' 
            WHEN attandence1 = 1  THEN 'Present' 
            ELSE 'OnLeave' END AS attandence1 from tablename


这篇关于数据库显示相关问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆