G
Guest
Hi i have a strange problem. I have a stored procedure which inserts a new
row and for one of the values gets a max of a number, adds 1 to it, then puts
this in an integer field. Probably easier if i paste it.
CREATE PROCEDURE dbo.sp_NewRef
AS
declare @nextnum int
SELECT @nextnum = max((anothernumber) + 1) from tblx
INSERT INTO tblx (reference) VALUES (@nextnum);SELECT SCOPE_IDENTITY()
GO
when I run exec sp_newref it creates a new row and returns me the id. when i
view the row it has definately made a new reference, latest one plus 1.
However, when i run this in my aspx page, it creates a new row but does not
create the new reference number. Value is <NULL>. Why? I would at least know
that it just wasnt working if it didnt create a row in the first place, but
it does!
row and for one of the values gets a max of a number, adds 1 to it, then puts
this in an integer field. Probably easier if i paste it.
CREATE PROCEDURE dbo.sp_NewRef
AS
declare @nextnum int
SELECT @nextnum = max((anothernumber) + 1) from tblx
INSERT INTO tblx (reference) VALUES (@nextnum);SELECT SCOPE_IDENTITY()
GO
when I run exec sp_newref it creates a new row and returns me the id. when i
view the row it has definately made a new reference, latest one plus 1.
However, when i run this in my aspx page, it creates a new row but does not
create the new reference number. Value is <NULL>. Why? I would at least know
that it just wasnt working if it didnt create a row in the first place, but
it does!