Help in procedure or function error ... expects parameter @ ... which was not supplied

0

MY PROCEDURE IS:

ALTER proc [dbo].[spinsertar_detalle_ingreso]
@id_detalle_ingreso int output,
@id_ingreso int, 
@id_producto int,
@precio_compra money,
@precio_venta money,
@precio_especial money,
@precio_especial2 money,
@stock_inicial int,
@stock_actual int,
@fecha_produccion date,
@fecha_vencimiento date
 as
 insert into detalle_ingreso (id_ingreso, id_producto, precio_compra, 
 precio_venta, precio_especial,
 precio_especial2, stock_inicial, stock_actual, fecha_produccion, 
 fecha_vencimiento)
 values (@id_ingreso, @id_producto, @precio_compra,
 @precio_venta, @precio_especial, @precio_especial2,
 @stock_inicial, @stock_actual, @fecha_produccion, @fecha_vencimiento)
    
asked by user9509702 24.12.2018 в 05:03
source

1 answer

2

Clearly the problem is at the moment that your application calls the Stored Procedure with the fourth parameter "@precio_compra". To find the problem, I recommend that you use the Performance Analyzer "Profiler" and that you reproduce the error. Just in the moment that you have the error in the screen of your application for the Performance Analyzer and you are looking for the call to the Stored Procedure, when you have it, you copy and paste it in the query analyzer and there you will find what is happening. Possibly you are calling the Procedure with only three parameters or you are missing a comma. If the call is well generated you should see something like:

EXEC [dbo].[spinsertar_detalle_ingreso] 
@id_detalle_ingreso = 102,
@id_ingreso = 80, 
@id_producto = 12003,
@precio_compra = 23.32,
@precio_venta = 28.45,
@precio_especial = 25,
@precio_especial2 = 24,
@stock_inicial = 100,
@stock_actual = 50,
@fecha_produccion = '20181224',
@fecha_vencimiento = '20181224'

It is also possible that in price_buying you have something like @precio_compra = 23.32, so the system is dealing with the parameters since when the whole part ends the next parameter should start. Anyway, it can be for many things but I'm almost sure that finding the call that your application generates with the Profiler and playing it in the Query Analyzer will find the reason and with it the solution.

    
answered by 24.12.2018 в 08:54