請問大家,我的想法是,在插入數據時,不允許用戶移動到其他記錄。應該如何做?
我試過,用OnBeforeScroll事件,但不行,在這事件裡檢查的狀態不是dsInsert。所以沒辦法終止移動,請問大家有辦法嗎?
我是使用ADOQuery+cxGrid的
我試過,用OnBeforeScroll事件,但不行,在這事件裡檢查的狀態不是dsInsert。所以沒辦法終止移動,請問大家有辦法嗎?
我是使用ADOQuery+cxGrid的
想实现你这样的功能,要设置一个全局ds_insert状态标志。
如:
在插入时,设置ds_insert:=True;
在OnBeforePost事件中,检查其状态,如果为真,则Abort;如果真的要保存,先设置ds_insert:=False,再Post.
EListError:List index out of bounds(0)
begin
if DataSet.State = dsInsert then
Abort;
end;这样应该可以