sp_helplogins

I tryning to program (in VB.net) sp_helplogins, assuming this is the correct sp to use to determine who is currently logged onto the database.

Ive already programmed, in VB.net, the execution of sp_helpuser and get correct results, but don't seem to be able to program sp_helplogins.

Any help would be appreciated.

Thanks,

/jerry



Answer this question

sp_helplogins

  • MattMc3

    Thanks Louis,

    I'll give sp_who2 a try... I ran it from MSDE Manager and it gives good results.. But, it lists all users on the server instance and not just the users of the specific database I want to find out about.

    Is there any way to narrow it down to as specific database

    /jerry


  • Tranzistors

    The error message I get is:

    "column name or number of supplied values does not match the table definition ..."

    I do believe it does have something to do with multiple results sets. Also, would this sp tell me who is logged on to the db.

    If you would move the post for me that would be appreciated.

    Thanks,

    /jerry


  • Randy J

    Okay, I've got it... filtered the db and it all works well.

    Thanks,

    /jerry


  • mnlarsen

    What error are you receiving Does this have to do with the fact that it has multiple result sets If so you might want to go to the VB.net forum (and we could move your post there if you want.)

  • Priyank001

    Hmm, no idea. Does this error happen immediately Are you just executing sp_helplogins in a .NET object Or something more

    Also, run the procedure in Query Analyzer or SSMS to see what it returns. That might help. All this proc returns is login information, then in a second result set it returns the databases for the users.



  • TGirgenti

    sp_helplogins definition via BOL: Provides information about logins and the users associated with them in each database.

    I would look at the sp_who sysprocs here they are:

    sp_who via BOL: Provides information about current users, sessions, and processes in an instance of the Microsoft SQL Server Database Engine. The information can be filtered to return only those processes that are not idle, that belong to a specific user, or that belong to a specific session.

    There is also a sp_who2 fyi.


  • AustinStephens

    You can use sp_who2 for this, or select from sysprocesses. ( I can't seem to find a way to get the same information from 2005's dynamic managment objects, perhaps someone else will post the new right way, and even sp_who2 still uses sysprocesses.)



  • Jo Molnar - MSFT

    Thanks,,, I've got sp_who working in vb.net now.

    /jerry


  • tgorrie

    Well, let me rephrase the question --

    How can I determine who is logged on to the database using vb.net

    I thought it might be sp_helplogins, but maybe there is something else.

    Thanks,

    /jerry


  • sp_helplogins