dbgrideh显示adoquery的结果ADOQuery.SQL.Text:=''a2:a5,是在sql里case when行转列as来的,沒有具体列名
max(case t.cbustype when '领料' then t.dveridate else null end) a2,
max(case t.cbustype when '发料' then t.dveridate else null end) a3,
max(case t.cbustype when '成品' then t.dveridate else null end) a4,
max(case t.cbustype when '销售' then t.dveridate else null end) a5这是查出来的结果 准备加的列
a1 a2 a3 a4 a5 //状态
T090611-436 2009-09-26 2009-06-26 2009-09-24 2009-10-01 //否
T090716-723 2009-08-03 2009-09-21 2009-09-24 2009-09-25 //是 我想在dbgrideh结果后面加一列状态,进行判断 if a2 or a4 or a5 is null 和 (a5>=a4>=a2不成立) 状态为否 else是请问该如何实现
max(case t.cbustype when '领料' then t.dveridate else null end) a2,
max(case t.cbustype when '发料' then t.dveridate else null end) a3,
max(case t.cbustype when '成品' then t.dveridate else null end) a4,
max(case t.cbustype when '销售' then t.dveridate else null end) a5这是查出来的结果 准备加的列
a1 a2 a3 a4 a5 //状态
T090611-436 2009-09-26 2009-06-26 2009-09-24 2009-10-01 //否
T090716-723 2009-08-03 2009-09-21 2009-09-24 2009-09-25 //是 我想在dbgrideh结果后面加一列状态,进行判断 if a2 or a4 or a5 is null 和 (a5>=a4>=a2不成立) 状态为否 else是请问该如何实现
adoqueryState.AsBoolean :=((a2='') or (a4='') or (a5='')) and (not ((a5>a4) and (a4>a2)));2、DbGridEh控件增加一个字段,连接到数据集里的State字段;
DBGrid1.Columns.Items[DBGrid1.Columns.Count].FieldName := '';
DBGrid1.Columns.Items[DBGrid1.Columns.Count].Title.Caption := '';
DBGrid1.Columns.Items[DBGrid1.Columns.Count].Title.Alignment := taCenter ;