MTSkull
Well-known member
I have a stored procedure which gets an int value from a table increments it by 1 then returns the result to the user and stores the new result back into the originating table. The stored procedure seems to work fine but, how do I access the return?
I tried
Stored Procedure
Thanks
Brian
I tried
Code:
strConn = "data source=" & gstrServer & ";"
strConn &= "initial catalog=" & gstrDB & ";"
strConn &= "Integrated Security=SSPI"
strSQL = "EXEC SP_Telesales_Return_Key "
strSQL &= "" & Table_Name & ""
sqlConnection = New SqlClient.SqlConnection(strConn)
sqlCommand = New SqlClient.SqlCommand(strSQL, sqlConnection)
sqlCommand.() ?now what???
Stored Procedure
Code:
CREATE PROCEDURE dbo.SP_Telesales_Return_Key(@Table_Name as varchar(100)) AS
DECLARE @Value AS INT
DECLARE @strReturn as varchar(50)
SET @Table_Name = ltrim(rtrim(@Table_Name))
SET @Value = (SELECT cast(Sys_Value as int) FROM Telesales_System WHERE Sys_Description = @Table_Name)
SET @Value = @Value + 1
UPDATE Telesales_System SET Sys_Value = cast(@Value as varchar(50)) WHERE Sys_Description = @Table_Name
RETURN @Value
GO
Brian