hi, i have a store procedure that insert a record and return a string to assign returned value to variable, im not sure where im making a mistake but it just hang on metastorm. but it the sp works fine on query analyzer. here is the store proc:
ALTER PROCEDURE [dbo].[UnifAddItem]
@parItemDescription varchar(50) ,
@parItemPrice varchar(50) ,
@parTypeID varchar(10)
AS
begin
SET NOCOUNT ON;
declare @Itemcode varchar(50), @maxNumber int, @curNumber int
set @maxNumber = (select REPLACE(dbo.UnifItems.ItemCode,'SAN','') from dbo.UnifItems where ID = (select max(id) from dbo.UnifItems))
set @curNumber = @maxNumber + 1
set @Itemcode = 'SAN' + cast(@curNumber as varchar(50))
INSERT INTO [Metastorm].[dbo].[UnifItems]
([ItemCode] ,[ItemDescription] ,[ItemPrice] ,[TypeID])
VALUES (@Itemcode ,@parItemDescription ,@parItemPrice ,@parTypeID )
Select @Itemcode
end
and code on Metastorm, when Button is clicked: %txtItemCode:= %SelectSQL("exec UnifAddItem '%txtItemAdd','%txtItemPrice','2'")
please help,
thanx