对查询结果中的某个空字段附值?
查询排序代码:
begin
rep_infor.resultQuery.Close;
rep_infor.resultQuery.SQL.Clear;
if (resultcombobox3.Text=floattostr(3)) then
rep_infor.resultQuery.SQL.Add('select top 3 号码,姓名,性别,单位,项目名称,成绩,得分 from perinfor_input')
else
if (resultcombobox3.Text=floattostr(4)) then
rep_infor.resultQuery.SQL.Add('select top 4 号码,姓名,性别,单位,项目名称,成绩,得分 from perinfor_input ')
else
if (resultcombobox3.Text=floattostr(5)) then
rep_infor.resultQuery.SQL.Add('select top 5 号码,姓名,性别,单位,项目名称,成绩,得分 from perinfor_input')
else
if (resultcombobox3.Text=floattostr(6)) then
rep_infor.resultQuery.SQL.Add('select top 6 号码,姓名,性别,单位,项目名称,成绩,得分 from perinfor_input');
rep_infor.resultQuery.SQL.Add('where 项目名称=:items and 性别=:sex order by 成绩 desc');
rep_infor.resultQuery.Parameters.ParamByName('items').Value:=sj;
rep_infor.resultQuery.Parameters.ParamByName('sex').Value:=xb;
rep_infor.resultQuery.Open;
end;
end;
rep_infor.resultQuery.First;
rep_infor.resultQuery.Edit;
下面开始对排出的顺序中的‘得分’字段添加数值。//错误之处?请指点
目的是为了按顺序不同给不同的分值,将排序的所有记录都附值。
begin
while not rep_infor.resultQuery.Eof do
begin
inc(row);
if row=1 then
rep_infor.resultQuery.FieldByName('得分').AsInteger:=7;
if row=2 then
rep_infor.resultQuery.FieldByName('得分').AsInteger:=5;
if row=3 then
rep_infor.resultQuery.FieldByName('得分').AsInteger:=4;
if row=4 then
rep_infor.resultQuery.FieldByName('得分').AsInteger:=3;
if row=5 then
rep_infor.resultQuery.FieldByName('得分').AsInteger:=2;
if row=6 then
rep_infor.resultQuery.FieldByName('得分').AsInteger:=1;
end;
rep_infor.resultQuery.Post;
rep_infor.resultQuery.Next;
end;