L
Laputa
Unregistered / Unconfirmed
GUEST, unregistred user!
用户在DBGrid上输入出错(如非空字段为空,日期字段输入无效值等)时会跳出系统提示,怎样截获
系统提示判断错误类型并用用自己的提示代替?
书上说在OnPostError中处理,可我试了试出错时根本不执行OnPostError过程:
设表里有两个字段a,b,B为非空字段,
procedure TForm1.Table1PostError(DataSet: TDataSet; E: EDatabaseError;
var Action: TDataAction);
begin
if (E as EDBEngineError).Errors[0].Errorcode=9732 then
begin
showmessage('B为非空字段');
Abort;
end;
end;
在DBGrid上填入a,提交,却直接跳出系统提示"field 'b' must have a value",单步跟踪
发现根本不运行OnPostError过程。请问该怎么办?
系统提示判断错误类型并用用自己的提示代替?
书上说在OnPostError中处理,可我试了试出错时根本不执行OnPostError过程:
设表里有两个字段a,b,B为非空字段,
procedure TForm1.Table1PostError(DataSet: TDataSet; E: EDatabaseError;
var Action: TDataAction);
begin
if (E as EDBEngineError).Errors[0].Errorcode=9732 then
begin
showmessage('B为非空字段');
Abort;
end;
end;
在DBGrid上填入a,提交,却直接跳出系统提示"field 'b' must have a value",单步跟踪
发现根本不运行OnPostError过程。请问该怎么办?