你好,有谁知道那个电子病历的吗?里面治疗效果有死亡,好转,痊愈,其他的。我想判断说一个住院号的病人如果有多条记录,因为医生有可能在同一份病历中写了死亡和痊愈,这就是错的,我想用一个判断语句,如果是错的给一个提示。下面是我写的代码,有错,请指教哈,急用。。
using System;
using System.Collections.Generic;
using System.Windows.Forms;namespace lzc02
{
static class Program
{
static void Main()
{
String treat_result= "select * from diagnosis where patient_id in (select patient_id from diagnosis where TREAT_RESULT='死亡' )"; /*
if (treat_result == "dead" && treat_result == "alive")
{
MessageBox.Show("输入有误,请重新填写治疗效果!"); }
else
{
MessageBox.Show("治疗效果输入正确"); ;
}
* */
if (treat_result == "dead")
{
if (treat_result == "alive")
{
MessageBox.Show("输入有误,请重新填写治疗效果!"); }
else
{
MessageBox.Show("治疗效果输入正确"); ;
}
}
}
}
}
using System;
using System.Collections.Generic;
using System.Windows.Forms;namespace lzc02
{
static class Program
{
static void Main()
{
String treat_result= "select * from diagnosis where patient_id in (select patient_id from diagnosis where TREAT_RESULT='死亡' )"; /*
if (treat_result == "dead" && treat_result == "alive")
{
MessageBox.Show("输入有误,请重新填写治疗效果!"); }
else
{
MessageBox.Show("治疗效果输入正确"); ;
}
* */
if (treat_result == "dead")
{
if (treat_result == "alive")
{
MessageBox.Show("输入有误,请重新填写治疗效果!"); }
else
{
MessageBox.Show("治疗效果输入正确"); ;
}
}
}
}
}
treat_result 赋的值是一个sql语句
也没有执行sql语句
然后下面就直接用treat_result判断了???if (treat_result == "dead")//这里更乱,没执行就让sql语句判断是否等于dead
{
if (treat_result == "alive")//这里呢?上面条件是如果是"dead"才进来,你再加这个有意义么,不如直接if else判断
{
MessageBox.Show("输入有误,请重新填写治疗效果!"); }
else
{
MessageBox.Show("治疗效果输入正确"); ;
}
}
{
String treat_result= "select * from diagnosis where patient_id in (select patient_id from diagnosis where TREAT_RESULT='死亡' )";
if (treat_result == "dead" && treat_result == "alive")
{
MessageBox.Show("输入有误,请重新填写治疗效果!"); }
else
{
MessageBox.Show("治疗效果输入正确"); ;
}
这个也是没执行SQL语句 怎么执行呢
建议你好好学些sql和数据库操作类,,你这写法,让我
(huhu454)
等 级:
结帖率:0.00% String treat_result= "select * from diagnosis where patient_id in (select patient_id from diagnosis where TREAT_RESULT='死亡' )";
你这SQL问不是用来执行的吗?
先查一下C#中间怎么从数据库中查出结果。这新手新的
这样就可以了