list of database users in drop down

metschke
07-31-2003, 03:33 PM
Is there a way to pull a list of all of the SQL database users that have access to a particular database and have them displayed in a drop down menu in a vb program?

Thanks,
Rick

reboot
07-31-2003, 03:51 PM
Look at sp_helpuser to get started.

metschke
08-01-2003, 08:49 AM
I researched sp_helpuser and I ran into a road block. How do I get one Username at a time?

Thanks for your help,
Rick

My code so far:

Dim oServer As New SQLDMO.SQLServer
Dim oDatabase As SQLDMO.Database

oServer.LoginSecure = True
oServer.Connect "(local)\MyDatabase"

Set oDatabase = oServer.Databases("MyDatabase")

strGetUserName= "exec sp_helpuser"

oDatabase.ExecuteImmediate strGetUserName

reboot
08-01-2003, 01:51 PM
Simple example:

rs.Open "EXEC sp_helpuser", conn

Do Until rs.EOF
Debug.Print rs!LoginName
Loop

metschke
08-01-2003, 03:01 PM
Would you please expand your code a little and give examples of how rs and conn is used.

Thanks

reboot
08-01-2003, 03:10 PM
There are tons of examples on this forum of doing ADO connections and recordsets. That's what the search button is for.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum