c#开发cast( (case when b.pbproject_ID is null then 1 else 0 end) as bit ) as if (Convert.ToBoolean(this.grvQuery.GetDataRow(i)["xz"]) == true){selected = true;}上面那个是条件

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/25 03:51:45
c#开发cast((casewhenb.pbproject_IDisnullthen1else0end)asbit)asif(Convert.ToBoolean(this.grvQuery.GetDa

c#开发cast( (case when b.pbproject_ID is null then 1 else 0 end) as bit ) as if (Convert.ToBoolean(this.grvQuery.GetDataRow(i)["xz"]) == true){selected = true;}上面那个是条件
c#开发cast( (case when b.pbproject_ID is null then 1 else 0 end) as bit ) as
if (Convert.ToBoolean(this.grvQuery.GetDataRow(i)["xz"]) == true)
{
selected = true;
}
上面那个是条件

c#开发cast( (case when b.pbproject_ID is null then 1 else 0 end) as bit ) as if (Convert.ToBoolean(this.grvQuery.GetDataRow(i)["xz"]) == true){selected = true;}上面那个是条件
cast( (case when b.pbproject_ID is null then 1 else 0 end) as bit ) as xz
这个是sql语句吧,cast()是用于转换数据类型的 如case('222' as int) 把字符串转换成整型
case when then是条件判断
整句的意思就是:
case when b.pbproject_ID is null then 1 else 0 end——当b.pbproject_ID为空数据时值为1,否则值为0
再用cast转换成bit类型的xz字段
if (Convert.ToBoolean(this.grvQuery.GetDataRow(i)["xz"]) == true)
就是把this.grvQuery.GetDataRow(i)["xz"]的值转换成布尔类型再判断是否为true,当为true时执行下面的变量赋值