我在做一个彩票软件,其中有一个数据显示问题,在一张表中有三列(百位,十位,个位),就百位来说,要显示成下面的样子
表中数据 显示数据
百位
百位 |0|1|2|3|4|5|6|7|8|9|
0 0
5 5
7 7
9 9
3 3
2 2
...
也就是一个中奖号码走势图,当百位号码是0,就显示在0列的位置,是5就显示在5列的位置,依次类推;
我用dbgrideh设计好的表头,下面就不知该怎样做了?用绑定字段的方式好像不行,用程序控制,不知在dbgrideh中怎样给指定的行,列赋值,请高手指点!
表中数据 显示数据
百位
百位 |0|1|2|3|4|5|6|7|8|9|
0 0
5 5
7 7
9 9
3 3
2 2
...
也就是一个中奖号码走势图,当百位号码是0,就显示在0列的位置,是5就显示在5列的位置,依次类推;
我用dbgrideh设计好的表头,下面就不知该怎样做了?用绑定字段的方式好像不行,用程序控制,不知在dbgrideh中怎样给指定的行,列赋值,请高手指点!
case when 百位=0 then 0 end,
case when 百位=1 then 1 end,
case when 百位=2 then 2 end,
case when 百位=3 then 3 end,
case when 百位=4 then 4 end,
case when 百位=5 then 5 end,
case when 百位=6 then 6 end,
case when 百位=7 then 7 end,
case when 百位=8 then 8 end,
case when 百位=9 then 9 end
回jing12,我没明白你这段代码的用在什么地方,能说详细点吗?
然后在OnCalcFields计算后赋值
procedure TForm1.Query1CalcFields(DataSet: TDataSet);
begin
case Query1.FieldByName('百位').Value of
0:query1.FieldByName('0').Value:=0;
1:query1.FieldByName('1').Value:=1;
2:query1.FieldByName('2').Value:=2;
3:query1.FieldByName('3').Value:=3;
4:query1.FieldByName('4').Value:=4;
5:query1.FieldByName('5').Value:=5;
6:query1.FieldByName('6').Value:=6;
7:query1.FieldByName('7').Value:=7;
8:query1.FieldByName('8').Value:=8;
9:query1.FieldByName('9').Value:=9;
end;
end;
加入以上代码!
就OK
再次谢谢各位了!