I typicially set up the return value as follows.
Dim objConn As New SQLConnection(dw.Data.CONN
Dim objCmdSP As New SQLCommand()
objCmdSP.CommandType = CommandType.StoredProcedur
objCmdSP.CommandText = "sp_MyStoredProcedure"
Dim prmReturn As New SqlParameter("return", SqlDbType.Int)
prmReturn.Direction = ParameterDirection.ReturnV
objCmdSP.Parameters.Add(pr
objConn.Open
objCmdSP.Connection = objConn
objCmdSP.ExecuteNonQuery()
objConn.Close
Dim intReturnVal As Integer
intReturnVal = Convert.ToInt32(prmReturn.
If intReturnVal = 1 Then
Return True
ElseIf intReturnVal > 1 Then
_ID = intReturnVal
Return True
Else
Return False
End If
Main Topics
Browse All Topics





by: srivatsavayePosted on 2006-10-18 at 08:53:52ID: 17757996
I think You have to add another parameter called @ReturnValue in your code with the direction ouput..
("@ReturnV alue", Data.SqlDbType.Int) tput
xParamUID = xCommandUID.Parameters.Add
xParamUID.Direction = Data.ParameterDirection.Ou
and then retrieve its value