vb.net, control if user has right to stored procedure on SQL Server

Before calling a stored procedure I would like to check if the user has rights to it. I use Integrated security and SQL Server 2000, Windows 2003 Server. Or maybe there is a better way to avoid failure in the application if the user has not right to run this SP.

Thanks in advance.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Why not just execute it and handle the exception?

If you check if the user has the rights you would have to querry the DB 2 times to get the job done. One time in order to check if he is allowed and once in order to get the work done. This is one wasted trip in case you succeed.

If you just try to execute it and handle the exception properly then you have not wasted a trip to the sql server since you accomplish both questions with one action. An exception is not allwas an evil thing to generate. See it as some information service also. There are places where you can efficently work with errors and i think this is a valid scenario for this :)
lagneskogAuthor Commented:
Thanks rdrunnder

Could you please provide a smal snippet of vb.net code as you thought it would look like.

        Dim oRead As Data.SqlClient.SqlDataReader
        SqlCommand1.Parameters(1).Value = "HILAA"
            oRead = SqlCommand1.ExecuteReader()
        Catch ex As SqlClient.SqlException
            If ex.Number = 229 Then
                MsgBox("No rights on the SP....")
            End If
        Catch ex As Exception

        End Try

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.