I don't think that is where i've gone wrong? |
| Pamela Ng replied at 24-Dec-05 09:29 |
Hi
I don't have identity as a data type.
Is uniqueidentifier data type the same as identity?
Btw, i thought the identity datatype is set in the stored procedure?
This is my stored procedure code:
ALTER PROCEDURE spInsertRating(@RatingReviewID VARCHAR OUTPUT, @Title VARCHAR(50), @Rating INT,
@Review VARCHAR(MAX), @ProductID VARCHAR(50), @Username VARCHAR(50))
AS
INSERT INTO ProductRatingAndReview(Title, Rating, Review, ProductID, Username)
VALUES (@Title, @Rating, @Review, @ProductID, @Username)
SET @RatingReviewID = SCOPE_IDENTITY()
RETURN
I think the way i declare at my codings for my 'page behind code' is wrong? Have to use data reader to retrieve the auto generated value?
Here are my codings in .NET again:
In .NET, for RatingReviewID, i have this:
'Adds the specified parameter object to the SQL parameter collection
myParm = dbCmd.Parameters.Add( "@RatingReviewID" , SqlDbType.SmallInt)
myParm.Direction = ParameterDirection.Output
and when executing the stored procedure:
Try
dbConn.Open()
dbCmd.ExecuteNonQuery()
Dim RatingReviewID As String = dbCmd.Parameters( "@RatingReviewID" ).Value
MsgBox( "Opinion successfully added!" , MsgBoxStyle.Information, "Product Rating" )
dbConn.Close()
Any ideas on what is wrong? How to change my codings to get it right? I've been very stuck at this for a very very long time =(. |
|