[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找不到,但明明有定义呢
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找不到,但明明有定义呢
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货