From 177b16b5c4b5a974a8c025ab138be75657ab77ed Mon Sep 17 00:00:00 2001 From: Ernesto Empty Date: Tue, 7 May 2019 10:03:40 +0000 Subject: [PATCH] Detectar si no se ha cambiado ningun registro (No existe NIS?) --- LectorVerdnatura/sdklector.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/LectorVerdnatura/sdklector.cs b/LectorVerdnatura/sdklector.cs index 75080ba..5540fbd 100644 --- a/LectorVerdnatura/sdklector.cs +++ b/LectorVerdnatura/sdklector.cs @@ -103,7 +103,10 @@ namespace LectorVerdnatura try { - db.ejecutarsql(SqlInsert); + int RowsAffected = db.ejecutarsql(SqlInsert); + if (RowsAffected == 0) { // = 0 pero sin error de ya existe puede ser que no existe el NIS + throw new Exception("Error: Ejecucion SQL no ha insertado datos. ¿No existe NIS: " + sdwEnrollNumber + " ?"); + } } catch (OdbcException ex) when (ex.Errors[0].NativeError == 1062) {