I have a .NET 2010 app hitting a SQL2000 db. The code is pretty basic. When I insert a record, the record is inserted, but the id is not returned. The id column is an int and it is an Idetity. Here is the stored proc...
ALTER PROCEDURE Insert_Vendor
@CorpID as varchar(255),
@TaxpayerID as varchar(255)
AS
Insert into dbo.Vendor
(
vdr_CorpID,
vdr_TaxpayerID
)
values
(
@CorpID,
@TaxpayerID
)
IF @@error <> 0
BEGIN
RETURN -1
END
ELSE
RETURN @@Identity
GO
And on the receiving end...
int myID = (int)(db.ExecuteScalar(dbCommand));