Trying to prevent multiple logins sp_$ndo$loginproc

txerifftxeriff Posts: 155Member
edited 2017-06-16 in NAV Three Tier
https://msdn.microsoft.com/en-us/library/dd338930.aspx
Hi all,

I have followed that, tried but nothing happens. I put it into the NAV database. Is that correct?
Thanks!

my code:



alter procedure [dbo].[sp_$ndo$loginproc]
@appname varchar(64) = NULL,
@appversion varchar(16) = NULL
as
begin

declare @login_count int

set @login_count=(SELECT count([User ID])
from [Active Session]
--where [User ID] not in (
-- [Here goes the user list I dont want to be applied this restriction, I removed I dont want to publish here. Anyway it does not work]
group by [User ID]
having count(*)>1)

if @login_count>;=1
raiserror ('You are already logged on %i time(s) to the system. Access is denied. Please try close all NAV windows or restart computer.', 18, 1, @login_count)
else
print('AllOK') --This message should happen right?

return
end


GO


It seems like it works, but only in dev. environment. RTC allows to open several sessions.

I also have seen this

https://dynamicsuser.net/nav/b/stryk/posts/prevent-multiple-logins-in-nav-with-sql-server

but the sql select statement to retrieve users seems not choosing actual ones from NAV, maybe its old.

Answers

Sign In or Register to comment.