How can maintain a SqlConnection (or using another component) open (connected) always during the execution of my .Net app?
I need this because my app needs to detect using this commnad
exec sp_who2
how many instances of my app are connected to mydatabase, to restrict the access (license control).
example
A) my app executed from location1
- check the number of my apps connected to the sql server using
exec sp_who2
- if the number of my applications < MaxLicencesConnected then start my app and open a sqlconnection
B) my app executed from location2
- check the number of my apps connected to the sql server using
exec sp_who2
- if the number of my applications >= MaxLicencesConnected then close my application
sorry for my english.
thanks in advance.