Dim objConnection As New SqlConnection
Dim objCommand As New SqlCommand
Try
OpenCase = False
objConnection.ConnectionString = "data source=SRV1;initial catalog=****;user id=****;Password=****;Connect Timeout=200"
objCommand.Connection = objConnection
objCommand.CommandTimeout = 200
objCommand.CommandType = CommandType.StoredProcedure
objCommand.CommandText = "****"
objCommand.Parameters.AddWithValue("@SSN", *********)
objCommand.Parameters.AddWithValue("@RETURNVALUE", "")
objCommand.Parameters("@RETURNVALUE").Direction = ParameterDirection.ReturnValue
objConnection.Open()
objCommand.ExecuteNonQuery()
objConnection.Close()
If objCommand.Parameters("@RETURNVALUE").Value 0 Then
MsgBox("Error", MsgBoxStyle.Critical, "******")
Else
'Stored Procedure ran succesfully
End If
Catch err As Exception
MsgBox("Source: " & err.Source & vbCrLf & _
"Message: " & err.Message, MsgBoxStyle.Critical, "Error")
Finally
If objConnection.State = ConnectionState.Open Then
objConnection.Close()
End If
objCommand.Dispose()
objConnection.Dispose()
End Try





