0

I have the following query

DS = SqlHelper.ExecuteDataset(ConfigurationManager.AppSettings("ADOConnectionString"), CommandType.StoredProcedure, "duMaurier", params)

I want to call this in a try

Catch ex As Exception
    Return "this"
End Try

How do I return a specific message of the error that prevents it running?

2
  • Are you looking for Return ex.Message? Commented May 25, 2015 at 16:08
  • Can you share the full function code please, I can't understand what kind of return you want. Commented May 25, 2015 at 16:37

2 Answers 2

2

.message is a property of the exception.

Return ex.message 'This is the string message of the error description
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the edit nhgrif. I somehow didn't hit the code option
-1

Like this

 Catch ex As Exception
       Throw New Exception("This is may handle exception Error")
 End Try

1 Comment

Return and rethrow are not the same thing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.