建议改善病情. [英] suggestion to improve condition.

查看:70
本文介绍了建议改善病情.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI
   我的数据表中有4列. COL0,COL1,COL2,COL3.
   在这4列中,只有一列应具有该值.即,如果col0具有值,则其余hte列应为空.如果Col1具有该值,则其他3列将为空.对于其他人也是如此列.
   
   我写了这样的条件,
   
    (({{0}<>''和{1} =''和{2} =''和{3} ='')或({0 =''和{1}<>''和{2} =''和{3} ='')或({0} =''和{1} =''和{2}<> ;''和{3} ='')或({0} =''和{1} =''和{2} =''以及 {3}<> '')'')
    
    有什么办法可以改善病情.
    
最后,我需要一个结果集,其中只有一个col具有值.

我的目标框架是2.0,但是感谢LINQ solutinos.

谢谢

Sanjay.

解决方案

您的代码很好.

如果适合您的设计,您可以考虑仅使用两列

ConditionColumn和ConditionValue

,以便您可以使用like  ConditionColumn ='{0}'ConditionValue ='{1}'


HI
    I have 4 columns in my datatable. COL0, COL1, COl2, COL3.
     In this 4 columns only one column should have the value. i.e., if col0 is having a value, rest of hte columns shluld be empty. IF Col1 is having the value, the other 3 columns shld be empty. similarly for the other  columns.
    
     I hvae written a condition like,
    
     ("({0} <> '' and {1} = '' and {2} = '' and {3} = '' ) or ({0} = '' and {1} <> '' and {2} = '' and {3} = '' ) or ({0} = '' and {1} = '' and {2} <> '' and {3} = '' ) or ({0} = '' and {1} = '' and {2} = '' and {3} <> '' )")
     
     Is there any way I could improve the condition.
     
     Finally I need a result set in which only one col has a value.

My target framework is 2.0, but eventhen LINQ solutinos are appreciated.

Thanks,

Sanjay.

解决方案

Your code is fine.

You may consider using just two columns, if it fits your design

ConditionColumn and ConditionValue 

so that you can use like ConditionColumn='{0}' ConditionValue ='{1}'


这篇关于建议改善病情.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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