Hi Experts,
My Requirement is To restrict to open a database if the database is already open with same userid. so that i want to know which codeunit calls when open a database.
(not a open company. when open company codeunit 1 called).please suggest me.
Thanks & Regards
lakshman
0
Comments
It is old catch no trigger exists on database open (I tested with debugger, first trigger is CompanyOpen in CU1 after company choice). IF SQL server option used, you can run following stored procedure trigged by SQL server agent.
GreenSmile
Regards
You can put any logic you want in here (it should not return result sets though) and it should have execute permissions granted to public.
NAV will execute this proc on database open (if it exists) and will disallow the connection if the proc raises an error message with RAISEERROR.
For example, you can check if there is a connection already using the current user ID as you mentioned, similar to the code shown in the previous post, and if so raise an error disallowing the new connection. This proc is documented I think in the Application Designers guide, although I cannot check that right now.
[You can also use this proc to have a message sent to NAV, which is displayed for information only in a dialog box, but allows the connection to continue. E.g. "System down for maintencance at 09:00"].
This posting is provided "AS IS" with no warranties, and confers no rights.
Here a link for all for $ndo$loginproc http://msdn.microsoft.com/en-us/library/dd338930.aspx
it's also explained in the Application Designer's Guide
Regards
If you look at a SQL Profiler trace you will see the (attempted) execution of the login proc when connecting.
Important: If you use this proc and grant execute permission to public, you are of course allowing all users to run it. That's not an issue if its only purpose is disallowing a connection, or showing a warning in the client - but any activity on the database should be avoided, or treated with caution.
This posting is provided "AS IS" with no warranties, and confers no rights.