Index过程:
IdxStr:=待检索记录的条件值;
FindRec:=False;
With Table1 Do
Begin
DisableControls;
Open;
First;
i:=1;
While i<=RecordCount Do
Begin
if FieldByName('检索字段')=IdxStr Then
Begin
CurNo:= RecNo;
FindRec:=True;
I:=RecordCount;
End;
Inc(i);
Next;
End;
Close;
If FindRec Then
Begin
Open;
First;
Edit;
MoveBy(CurNo);
................
修改记录
Post;
Close;
End;
EnableControls;
End;
删除过程:
DelStr:=删除记录的条件值;
With Table1 Do
Begin
DisableControls;
Open;
First;
while Not eof Do
Begin
If FieldByname('检索字段')=DelStr Then
Delete;
Next;
End;
Close;
EndableControls;
end;
这只是个基本算法,删除记录时是否还得判断数据库是否为空等过程你自己解决!