I have a storeprocedure:
CREATE PROCEDURE [dbo].[BrandDrugDetailsInsert]
@BrandDrugDetailsID uniqueidentifier OUTPUT,
@BrandDrugID uniqueidentifier
AS
BEGIN
INSERT INTO Pharmacy_BrandDrugDetails(BrandDrugID) OUTPUT INSERTED.BrandDrugDetailsID
VALUES (@BrandDrugID)
END
Anytime i try to retieve the value "@BrandDrugDetailsID" using:
param[0] = new SqlParameter("@BrandDrugDetailsID", SqlDbType.UniqueIdentifier);
param[0].Direction = ParameterDirection.Output;
.
.
.
identity = new Guid(param[0].Value.ToString());
I get a null value.
If i try executing the storeprocedure from sqlserver itself, three values are returned:
- BrandDrugDetialsID = "471D08BA-382B-4F83-BECC-F96FEF84B5A5"
- @BrandDrugDetialsID = NULL
- Return Value = 0
I can't figure out what im doing wrong. Please help me.