Hola amigos,
Hice otra prueba y decidí hacer la sentencia sql del insert y ejecutar el método ExecSQL en vez del Metodo Post. Este es el código:
Cita:
procedure TForm1.btnOtroInsertClick(Sender: TObject);
begin
b.OtroQuery.Close;
b.OtroQuery.SQL.Text := 'INSERT INTO PRESENCIA_TECNICA_ESPERADA ( ' +
' codigo_compania, codigo_supervisor, codigo_distrito, fecha, codigo_producto, ' +
' cantidad_esperada, estatus) values (:com, :sup, :dist, :fech, ro, :esp, :est)';
b.OtroQuery.Parameters.ParamByName('com').Value := 'CAB';
b.OtroQuery.Parameters.ParamByName('sup').Value := '92001';
b.OtroQuery.Parameters.ParamByName('dist').Value := '12a';
b.OtroQuery.Parameters.ParamByName('fech').Value := StrToDate('10/10/2009');
b.OtroQuery.Parameters.ParamByName('pro').Value := 1;
b.OtroQuery.Parameters.ParamByName('esp').Value := 5;
b.OtroQuery.Parameters.ParamByName('est').Value := 'REGISTRADA';
try
B.OtroQuery.ExecSQL;
except
on E:EOleException do
begin
ShowMessage('Mi mensaje de error' + E.Message + ' ' + INTTOSTR(E.ErrorCode));
END;
end;
end;
|
De esta manera fue que pude capturar el la excepción de la clase EOleException. No se si tiene algo que ver con el Método post el hecho que me dispare dos clases de excepciones diferentes.
Otra cosa que noté fue que utiliza la misma codificación para estas dos excepciones:
//-2147217873 Violation of UNIQUE KEY constraint
//-2147217873 Cannot insert the value NULL into column
Muchas gracias por su ayuda.
Saludos.-