Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Bases de datos > MySQL
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #2  
Antiguo 11-06-2010
osmuar_exp osmuar_exp is offline
Miembro
 
Registrado: ene 2008
Posts: 18
Poder: 0
osmuar_exp Va por buen camino
Procedimiento Almacenado

Hola, con este procedimiento que debes de crear te modifica la tabla, solamente que debes de mandarle los parametros...

1) Procedimiento Almacenado
Código SQL [-]
CREATE PROCEDURE Actualizar (ENTREGA INTEGER(11), CIUDAD CHAR(50), ID INTEGER(11), TIPO integer(11) )
    NOT DETERMINISTIC
    SQL SECURITY DEFINER
    COMMENT ''
BEGIN
    SET @s = CONCAT('update tablaX set entrega =' , ENTREGA , ' where ciudad = ', CIUDAD, ', id = ' , ID, ', tipo = ' , TIPO);
    PREPARE consulta FROM @s;
    EXECUTE consulta;
  END;


2) Consulta para mandarle los parámetros al procedimiento
Código Delphi [-]
procedure Actualizar(entrega:integer; ciudad:string; id:integer; tipo:integer);
 var xConsulta:TADOQuery;
 begin 
    xConsulta:=TADOQuery.Create(nil);
    xConsulta.Connection:=frm_md.conexion;
    try
      with xConsulta do
       begin
           close;
           sql.Text:='call Actualizar('+IntToStr(entrega)+','+QuotedStr(ciudad)+','+inttostr(id)+','+IntToStr(tipo)+')';
           ExecSQL;
       end;
    finally
      xConsulta.free;
  end;
 end;
3) Y para mandarlo en delphi seria algo asi:
Código Delphi [-]
Actualizar(0,'MEX',253,1);

Saludos
Responder Con Cita
 



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

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Zeos, Stored Procedure y Parametros betto MySQL 3 18-02-2017 03:45:30
Stored Procedure !!! Ledian_Fdez C++ Builder 0 02-03-2010 14:01:29
Stored Procedure StartKill MySQL 2 27-08-2008 06:18:44
Ver los Stored Procedure tgsistemas SQL 0 06-04-2004 17:18:22
Stored Procedure tgsistemas SQL 1 27-02-2004 13:10:33


La franja horaria es GMT +2. Ahora son las 01:29:13.


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