限制从应用程序访问数据库的用户数

问题描述:

大家好,



我们在SQL Server 2008 R2上有一个带有数据库的vb.net应用程序,例如10个客户端使用其唯一的用户ID访问数据库。



问题是我无法使用某种锁来阻止超过10个用户访问该应用程序。

我不希望15-20个用户访问我们的应用程序和购买仅10个用户的许可证副本。





提前致谢

Hi all,

We have a vb.net application with database on the SQL server 2008 R2 and for example 10 clients accessing the database with their unique userids.

The issue is I'm not able to apply some sort of a lock to prevent more than 10 users accessing the application.
I don't want 15-20 users accessing our application and purchasing license copy of only 10 users.


Thanks in advance

将登录列添加到users表(或另一个包含会话信息的表,这可能会更好)。用户登录时,更新此列或表,计算活动会话数。如果活动会话数>许可会话,向用户显示错误,说明他们已超过并发许可证。
Add a "logged in" column to your users table (or another table that holds session information, which would probably be better). When the user logs in, update this column or table, counting the number of active sessions. If the number of active sessions > licensed sessions, display an error to the user saying they've exceeded their concurrent licenses.