如果条件在C#.net中无法正常工作? [英] If Condition not working correctly in C#.net?
本文介绍了如果条件在C#.net中无法正常工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我很挣这个问题,请参阅< completed>中的两个文件标签
i想输出,完成值= 0条件好,否则治疗中止...
please请帮助我..
XML文件1
Hi,
I am very struggle this problem, please see two file in <completed> tag
i want output,completed value=0 condition OK, otherwise Treatment Aborted...
please kindly help me..
XML file 1
<start></start>
<?xml version='1.0'>
<pit>
<vol>100</vol>
<hct>1.0</hct>
<joule>8.82</joule>
<jouleend>0.00</jouleend>
<complete>0</complete>
<runt ime>6.42</runt ime>
<pauset ime>0.00</pauset ime>
<nrpause>00</nrpause>
<temparature<27.5</temperature>
</pit>
< br $>
XML文件2
XML file 2
<start></start>
<?xml version='1.0'>
<pit>
<vol>100</vol>
<hct>1.0</hct>
<joule>8.82</joule>
<jouleend>0.00</jouleend>
<complete></complete>
<runt ime>6.42</runt ime>
<pauset ime>0.00</pauset ime>
<nrpause>00</nrpause>
<temparature<27.5</temperature>
</pit>
case "complete":
if (reader.Read())
{
if (reader.Value==null)
{
ProcedureCompletedTextBox.Text = "Treatment Aborted";
csvData.Append("Treatment Aborted" + ";");
}
else
{
ProcedureCompletedTextBox.Text = "OK";
csvData.Append("OK" + ";");
}
}
先谢谢
Thanks in Advance
推荐答案
尝试检查if(string.IsNullOrEmpty(reader.Value))
,或者,如果肯定知道非空,if (reader.Value!= string.Empty)
。
感谢Om Prakash Pant建议检查是否为空。
-SA
Try to checkif (string.IsNullOrEmpty(reader.Value))
or, if it is certainly known to be non-null,if (reader.Value != string.Empty)
.
Credit to Om Prakash Pant for suggestion to check for null.
—SA
这篇关于如果条件在C#.net中无法正常工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文