ADOQuery连接SQL Server刷新后停留在原位置

Delphi 7里使用ADOQuery控件连接SQL Server查询刷新后停留在原位置,显示控件可以是DBGrid或DBGridEh。
 
例一:
procedure TForm1.BitBtn1Click(Sender: TObject);
var
     DoubleNo_nid: Integer;
Begin
     DoubleNo_nid:=DM.Double_Query.RecNo;
  try
       with DM.Double_Query do
        begin
         Close;
         SQL.Clear;
         SQL.Add('select * from DoubleNo order by 接收日期');
         Open;
         DM.Double_Query.RecNo:=DoubleNo_nid;
        end;
  except
       ShowMessage('刷新出错!');
  end;
End;
 
例二:
procedure TForm1.BitBtn2Click(Sender: TObject);
var
     MultiNo_nid: Integer;
Begin
     MultiNo_nid:=DM.Multi_Query.RecNo;
  try
       with DM.Multi_Query do
        begin
         Close;
         SQL.Clear;
         SQL.Add('select * from MultiNo order by 接收日期');
         Open;
         DM.Multi_Query.RecNo:=MultiNo_nid;
        end;
  except
       ShowMessage('刷新出错!');
  end;
End;
 

你可能感兴趣的:(sql,数据库,server,休闲,ADOQuery)