Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check how many users that are connected to an SQL server database 1

Status
Not open for further replies.

lechuck

Programmer
Sep 4, 2000
26
SE
Is there any way from VB code to check how many computers/users that are connected to an database on an SQL server 7.

I have a program that i have developed in VB that works against an SQL server. Now i want to implement an licens check, so if a customer has 5 license the program will only allow 5 simultanious users against the server.

Is there any easier/better way of solving this problem?
Thaks
 
To answer your question, I first I got all wrapped up in looking for the meaning of the "status" column in the syslogins table, figuring that a bit would be flipped when someone was logged in.

But I found an easier way: Run the sp_who stored procedure. It gives you results that look like this:
[tt]sp_who
go
spid status loginame hostname blk dbname cmd
------ ---------- -------- --------- ----- ---------- ----------------
1 sleeping sa 0 master MIRROR HANDLER
2 sleeping sa 0 master LAZY WRITER
3 sleeping sa 0 master CHECKPOINT SLEEP
4 sleeping sa 0 master RA MANAGER
10 sleeping Mary WKSTA1 0 pubs AWAITING COMMAND
11 runnable Joe WKSTA5 10 pubs SELECT
[/tt]

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top