| Ver tema anterior :: Ver tema siguiente |
| Autor |
Mensaje |
Carlos J. Fernandez Master


Registrado: 27 Oct 2004Mensajes: 574
|
Publicado: Jue 04 Ene, 2018 1:46 pm Asunto: repuesta de ADOCommand en un Update o Insert |
|
|
Hola a todos,
En una sentencia en un ADOCommand hago algo parecido a esto:
update test set name='john' where id=3012
IF @@ROWCOUNT=0
insert into test(name) values('john');
intenta hacer un Update y si da error un Insert.
Mi pregunta es, como puedo saber si lo ha realizado es un update o un insert o nada?
Muchas gracias.
Carlos _________________ Carlos J. Fernandez |
|
| Volver arriba |
|
 |
Angel Master


Registrado: 15 Abr 2003Mensajes: 2311Ubicación: Toledo (España)
|
|
| Volver arriba |
|
 |
Angel Master


Registrado: 15 Abr 2003Mensajes: 2311Ubicación: Toledo (España)
|
Publicado: Vie 05 Ene, 2018 12:08 pm Asunto: |
|
|
Por otra parte se me ocurre, viendo el código que pones, algo así:
| Cita: | update test set name='john' where id=3012
IF @@ROWCOUNT=0
insert into test(name) values('john');
ELSE
"ACTUALIZADO" |
_________________ Un saludo
Necesitamos tu ayuda: Envía AI al 27595 (Coste 1,20 euros + IVA) |
|
| Volver arriba |
|
 |
Carlos J. Fernandez Master


Registrado: 27 Oct 2004Mensajes: 574
|
Publicado: Jue 22 Feb, 2018 4:27 pm Asunto: |
|
|
| Angel escribió: | Por otra parte se me ocurre, viendo el código que pones, algo así:
| Cita: | update test set name='john' where id=3012
IF @@ROWCOUNT=0
insert into test(name) values('john');
ELSE
"ACTUALIZADO" |
|
Buff un poco complicado no?
Eso que no se, debería tener algún dato de respuesta diría yo el ADOCommand
Muchas gracias _________________ Carlos J. Fernandez |
|
| Volver arriba |
|
 |
|