Using SMO to find out if the user has Admin permissions

Category: sql server smodmo

Question

JamesBarnaby on Wed, 18 Sep 2013 16:41:18


Hi all

I'm converting some old VB6 code that used SQLDMO to VB.NET 2005. It basically (forgive the pun) does a mass of database updates to our core databases. The user running the utility has the ability to push a button to test their connection, and as part of this the old system checked to see if they had admin rights to the db. Does anyone know how to check this using SMO?

Cheers

J

Replies

cmille19 on Wed, 18 Sep 2013 19:57:00


The SMO Login Class has an IsMember method:

http://technet.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.login.ismember.aspx

JamesBarnaby on Fri, 20 Sep 2013 07:56:23


thank you :)