Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > SQL
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

 
 
Herramientas Buscar en Tema Desplegado
  #3  
Antiguo 07-02-2005
lucianojdg lucianojdg is offline
Miembro
 
Registrado: dic 2003
Posts: 42
Poder: 0
lucianojdg Va por buen camino
Perdón, no se que sucedio que quedo muy mal tabulado... lo reescribo para que sea legible.


El problema es que no estas manejando bien las transacciones:

Prueba con Esto:

// fDatos es un DataModule
// Server es el componente TDataBase
Código Delphi [-]
 if fDatos.Server.InTransaction then fDatos.Server.RollBack;
   fDatos.Server.StartTransaction;
 try 
   FClientes.QueryClientes.SQL.Clear; 
   FClientes.QueryClientes.SQL.Add('insert into clientes');     
   FClientes.QueryClientes.SQL.Add(' values (:codigo, :nombre, :dni, :nomb_comerc, :direccion;'); 
   FClientes.Queryclientes.ParamByName('codigo').AsString:= ECodigo.Text;   
   FClientes.Queryclientes.ParamByName('nombre').AsString:= ECliente.Text; 
   FClientes.QueryClientes.ParamByName('dni').AsString:= EDni.TExt; 
   FClientes.QueryClientes.ParamByName('nomb_comerc').AsString:= Enombcomer.text; 
   FClientes.QueryClientes.ParamByName('direccion').AsString:= Edirecc.text;   
   FClientes.Queryclientes.ExecSQL; fDatos.Server.Commit;
 except
   if fDatos.Server.InTransaction then
     fDatos.Server.Rollback; 
   
   MessageDlg('Se ha producido un error al intentar agregar el Cliente.', mtError, [mbOK], 0); 
 end;
 
 FClientes.QueryClientes.SQL.Clear;
 FClientes.QueryClientes.SQL.Add('select * from clientes');
 // FClientes.QueryClientes.Close; no es necesario cuando haces un clear
 FClientes.QueryClientes.Open;

Saludos
__________________
Luciano DG

Última edición por marcoszorrilla fecha: 07-02-2005 a las 15:36:42.
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 15:53:41.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi