[code]
var
  id, ornum: integer;
begin
  id := adoquery1.FieldByName('id').AsInteger;
  ornum := adoquery1.FieldByName('ornum').AsInteger - 1;
  adoquery1.Close;
  adoquery1.SQL.Clear;
  adoquery1.sql.add('update zhiweibiao set [ornum]=ornum-1 where id=' + inttostr(id));
  adoquery1.ExecSQL;
  adoquery1.Close;
  adoquery1.SQL.Clear;
  adoquery1.sql.add('update zhiweibiao set [ornum]=ornum+1 where id<>' + inttostr(id) + ' and ornum=' + inttostr(ornum));
  adoquery1.ExecSQL;
  adoquery1.Close;
  adoquery1.SQL.Clear;
  adoquery1.sql.Text := 'select * from zhiweibiao order by ornum';
  adoquery1.Open;
  adoquery1.Locate('id', id, []);
end;[/code]
通过上面的代码,我实现不了呢,总是提示我ornum找不到,但明明有定义呢