I have searched the forums for a way to call a stored procedure and I have not found one that has helped me to accomplish my task. I want to be able to execute a stored procedure after a a record is added using some of the field values from the new record.
Here is the stored procedure:
CREATE PROCEDURE [dbo].[sp_FamilySerialUpdate]
@item varchar(100),
@WO varchar(50),
@CB varchar(50),
@CD varchar(50),
@QTY int,
@serial varchar(50)
AS
DECLARE @counter int;
SET @counter = 0;
IF @QTY = 1
UPDATE FamilySerialIssued
SET Serial = Serial + 1
WHERE
[dbo].[FamilySerialIssued].[Item] = @item
ELSE
WHILE (@counter < @QTY)
BEGIN
SET @counter = @counter + 1
UPDATE FamilySerialIssued
SET Serial = Serial + 1
WHERE
[dbo].[FamilySerialIssued].[Item] = @item
SET @serial = (SELECT Serial FROM dbo.[FamilySerialIssued] WHERE Item = @item)
INSERT into dbo.[FamilySerial Number] ([Item], [WO Number], [Serial Number], [Created by], [Created Date], [QTY])
VALUES (@item, @WO, @serial, @CB, @CD, 0)
END
GO
Essentially I want to run the MSSQL command:
exec sp_FamilySerialUpdate '@item', '@WO' etc.
Replacing the parameters with values from the added recorded.
I am running ASPRunner 5.2 and I assume I can added this to the event page, I am just not sure how to implement this or can this even be done through ASP runner? Many thanks in advance!