我使用TADOTable
方法在重复Locate
查找时遇到问题。以下代码第一次执行时没有问题,但任何后续执行都会引发Stack Overflow
异常。
procedure TForm14.Button1Click(Sender: TObject);
begin
ADOTable1.Open;
if not ADOTable1.Locate('Num-permis', Edit1.Text, []) then
ShowMessage(' Try it with another number, the figure does not exist');
end;
如何解决此问题?
答案 0 :(得分:1)
您需要每次都停止打开表格,或者每次都开始关闭它。第一个是我的偏好:
procedure TForm14.Button1Click(Sender: TObject);
begin
if not ADOTable.Active then
ADOTable1.Open;
if not ADOTable1.Locate('Num-permis', edit1.Text, []) then
ShowMessage(' Try it with another number, the figure does not exist');
end;