Error en Store Procedure
Publicado por Jesus (9 intervenciones) el 02/12/2004 23:28:54
Alguien sabe porque esto si me funciona en el analizador de consultas de la siguiente manera:
declare @factura as Varchar(8)
declare @movimiento as Int
declare @almacen AS Int
set @factura='500'
set @movimiento=200
set @almacen=1
if (select factura from cab_compras where id_movimiento=@movimiento and id_almacen=@almacen)<>@factura
begin
update cab_compras
set factura=@factura
where id_movimiento=@movimiento and id_almacen=@almacen
end
Pero lo pongo en un SP de la siguiente forma y no funciona
CREATE PROCEDURE [spAdmonCompras]
(
@factura as Varchar(8),
@movimiento as Int,
@almacen AS Int,
)
AS
if (select factura from cab_compras where id_movimiento=@movimiento and id_almacen=@almacen)<>@factura
begin
update cab_compras
set factura=@factura
where id_movimiento=@movimiento and id_almacen=@almacen
end
lo mando llamar desde VB con la siguiente instrucción:
CSQL.CommandText = "execute spAdmonCompras '"
CSQL.CommandText = CSQL.CommandText & txtFactura.Text & "',"
CSQL.CommandText = CSQL.CommandText & txtEA.Text & ","
CSQL.CommandText = CSQL.CommandText & Almacen
Set CSQL.ActiveConnection = Bd
Set rstBusqueda = CSQL.Execute
Gracias de antemano a todos...
declare @factura as Varchar(8)
declare @movimiento as Int
declare @almacen AS Int
set @factura='500'
set @movimiento=200
set @almacen=1
if (select factura from cab_compras where id_movimiento=@movimiento and id_almacen=@almacen)<>@factura
begin
update cab_compras
set factura=@factura
where id_movimiento=@movimiento and id_almacen=@almacen
end
Pero lo pongo en un SP de la siguiente forma y no funciona
CREATE PROCEDURE [spAdmonCompras]
(
@factura as Varchar(8),
@movimiento as Int,
@almacen AS Int,
)
AS
if (select factura from cab_compras where id_movimiento=@movimiento and id_almacen=@almacen)<>@factura
begin
update cab_compras
set factura=@factura
where id_movimiento=@movimiento and id_almacen=@almacen
end
lo mando llamar desde VB con la siguiente instrucción:
CSQL.CommandText = "execute spAdmonCompras '"
CSQL.CommandText = CSQL.CommandText & txtFactura.Text & "',"
CSQL.CommandText = CSQL.CommandText & txtEA.Text & ","
CSQL.CommandText = CSQL.CommandText & Almacen
Set CSQL.ActiveConnection = Bd
Set rstBusqueda = CSQL.Execute
Gracias de antemano a todos...
Valora esta pregunta


0