Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
BendJoe
Posting Yak Master
128 Posts |
Posted - 2008-11-10 : 05:01:43
|
| ( @Guid uniqueidentifier, @UserID int, @MediaBoxID int output )ASBEGIN SET NOCOUNT ON;BEGIN TRANSACTION--Declare @MediaBoxID int;Insert Into MediaBox (MediaBoxGUID,DateAdded,UserAdded) values (@Guid,getdate(),@UserID);Set @MediaBoxID=Scope_Identity();IF @@ERROR <> 0 BEGIN ROLLBACK RAISERROR ('Error in Inserting into MediaBox.', 16, 1) RETURN ENDUpdate ProfileInfo Set MediaBoxID=@MediaBoxIDwhere ProfileID=@UserIDIF @@ERROR <> 0 BEGIN ROLLBACK RAISERROR ('Error in Updating ProfileInfo.', 16, 1) RETURN ENDCOMMITSelect @MediaBoxIDENDI am trying to get an output parameter from the above procedure.Below is the ADO.NET codepublic static int AddMediaBoxGUIDByUserID(Guid guid, int userID, int mediaBoxID) { mediaBoxID = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionString, "usp_AddMediaBoxGUIDByUserID", guid, userID,mediaBoxID ); return mediaBoxID; }I am trying to get a return parameter for the first time. Some thing is going wrong. The procedure is getting executed as I can see the insert results. But the output parameter is not comming. Could someone help me. |
|
|
lionofdezert
Aged Yak Warrior
885 Posts |
Posted - 2008-11-10 : 05:06:32
|
| possibly you r missing @parameter OUT while executing...read out visakh replies http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=114111 |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-10 : 05:11:25
|
| you need to specify the output property in ADO.NET code as wellhttp://www.eggheadcafe.com/community/aspnet/10/10049998/u-get-output-parameter-va.aspx |
 |
|
|
|
|
|
|
|