Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   SQL (https://www.clubdelphi.com/foros/forumdisplay.php?f=6)
-   -   Guardar usando store procedure (https://www.clubdelphi.com/foros/showthread.php?t=76885)

ronimaxh 02-12-2011 01:48:39

Guardar usando store procedure
 
Saludos amigos del club, estoy comenzando a utilizar guardar usando store proceduer no se que me falta me da el error presentado mas abajo:
Código Delphi [-]
//mi codigo:
 with frmdata do
       begin
         sp_sql.ProcedureName:='SP_guarda_tipo_persona';
         sp_sql.Parameters.ParamByName('@desc_tipo').Value:=FrmTiposPersona.desc_tipo_edit.Text;
         sp_sql.Prepared:= True;
         try
           if not conexion.InTransaction=true then conexion.BeginTrans;
           sp_sql.ExecProc;
           conexion.CommitTrans;
         except
           conexion.RollbackTrans;
         end;
       end;

//Error que da:
---------------------------
Debugger Exception Notification
---------------------------
Project Simotesis.exe raised exception class EDatabaseError with message 'sp_sql: Parameter '@desc_tipo' not found'.
---------------------------
Break   Continue   Help   
---------------------------

Nota: Estoy usando componentes ado, base de datos sqlexpress

Neftali [Germán.Estévez] 02-12-2011 10:38:51

Prueba a realizar la llamada sin el @ en el nombre del parámetro.

ronimaxh 02-12-2011 14:43:44

Ya hice el cambio y sigue saliendo el mismo error.

Casimiro Noteví 02-12-2011 14:51:26

¿Y se puede ver el store procedure?

ronimaxh 02-12-2011 23:00:54

Código Delphi [-]
--a este store procedure es que estoy haciendo llamada.
USE [db_simotesis]
GO
/****** Object:  StoredProcedure [dbo].[SP_guarda_tipo_persona]    Script Date: 12/02/2011 17:50:47 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:  Miguel Garcia
-- Create date: 28/11/2011
-- Description:  Guarda Tipo Persona
-- =============================================
Create Procedure SP_guarda_tipo_persona
  -- Add the parameters for the stored procedure here
    @desc_tipo varchar(50)
AS
BEGIN
  -- SET NOCOUNT ON added to prevent extra result sets from
  -- interfering with SELECT statements.
  SET NOCOUNT ON;

    -- Insert statements for procedure here
  insert into tb_tipo_persona_m (descripcion_tipo)values(@desc_tipo)
END

oscarac 02-12-2011 23:07:24

prueba asi
Código SQL [-]
Create Procedure SP_guarda_tipo_persona (@desc_tipo varchar(50))


La franja horaria es GMT +2. Ahora son las 04:51:01.

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