对查询结果中的某个空字段附值?

sssyyy sssyyy 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
查询排序代码:
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;
...全文
评论 6
收藏 已收藏
分享
返回顶部
sssyyy
Delphi 5,944 成员 262,941 内容