Connected to the server or working local
ngebhard
Member Posts: 127
Hi everybody,
does anybody know how to find out if the database I'm working in is connected to the server or if I'm working local? I mean the information shown in the connection-tab using the path "file>database>information". I need to know that in a procedure to decide which function should be used and I can't find this information in any of the tables given, even not if search the "invisble tables" using a form.
Any ideas?
Thanks a lot.
Best regards,
N. Gebhard
does anybody know how to find out if the database I'm working in is connected to the server or if I'm working local? I mean the information shown in the connection-tab using the path "file>database>information". I need to know that in a procedure to decide which function should be used and I can't find this information in any of the tables given, even not if search the "invisble tables" using a form.
Any ideas?
Thanks a lot.
Best regards,
N. Gebhard
ProTAKT Projekte & Business Software AG
Microsoft Dynamics NAV Partner
Bad Nauheim, Germany
http://www.protakt.de
http://twitter.com/protakt
Microsoft Dynamics NAV Partner
Bad Nauheim, Germany
http://www.protakt.de
http://twitter.com/protakt
0
Comments
-
ngebhard wrote:Hi everybody,
does anybody know how to find out if the database I'm working in is connected to the server or if I'm working local? I mean the information shown in the connection-tab using the path "file>database>information". I need to know that in a procedure to decide which function should be used and I can't find this information in any of the tables given, even not if search the "invisble tables" using a form.
I tried as you have to look for a function or something similar that would reveal that information. Didn't have any luck.
Have you considered alternative methods for determining this? Ie. to check the name of the current database? If you are lucky then the database you are running locally vs. the one the server runs are not located on the same drive or in the same folder. They may even be named differently. Thus you could hardcode (slaps my own wrist) the name of the server's database and check the name at runtime. This info is located in the virtual table "session" btw.Best regards
Tommy0 -
Hi.
I make so that I rename the Company in my Local Databases.
So I can see directly/quickly if i am work on the Server or on a local Database.
Navision makes Temporary Files in a Path, you can try the option that your Server Database put this Files in a defined Path and for Local Databases Configure so that Navision put the Files in another Temp Path.
So you can see every Time if Temporary Files in a Path that you a working on it.(Oo)=*=(oO)0 -
See the following how-to: http://www.mibuso.com/howtoinfo.asp?FileID=2
Note especially thatThe function fctGetServerName returns [... blank] when connected to a local database0 -
Some other solution: if you know path and file name, if you are working localy, you find this file, if you are working on server (on another PC) you cannot find this file on local PC (if same path and file is not existing on you local PC).0
-
Try CONTEXTURL.
In my function on main menu I parsed the result of contexturl to display this msg:
Microsoft Navision Attain
CONTEXTURL:
[url=navision://client/run]navision://client/run[/url]
servername=sql1
database=KZDR
company=Cronus d.o.o.
servertype=MSSQL
OKltContextURL := CONTEXTURL; liPos := STRPOS(ltContextURL, '\'); WHILE liPos > 0 DO BEGIN ltContextURL := DELSTR(ltContextURL, liPos, 1); ltContextURL := INSSTR(ltContextURL, '%1', liPos); liPos := STRPOS(ltContextURL, '\'); END; ltContextURL := CONVERTSTR(ltContextURL, '&?', '\\'); MESSAGE('CONTEXTURL:\\'+ltContextURL,'\');®obi
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯0 -
Actually here is a function I use on different version & servers:
PROCEDURE ADGetServerDBInfo@1000000000(ltWhatToGet@1000000003 : Text[30]) ltReturnName : Text[255]; VAR ltTemp@1000000004 : Text[250]; liPos@1000000005 : Integer; lrSession@1000000000 : Record 2000000009; BEGIN // ADGetServerDBInfo //-AD.RM { Usage: Call ADGetServerDBInfo('servername=') to Get Server Name Call ADGetServerDBInfo('servertype=') to Get Server Type Call ADGetServerDBInfo('database=') to Get Database Name Call ADGetServerDBInfo('company=') to Get Company Name } ltReturnName := '<unknown>'; ltTemp := CONTEXTURL; liPos := STRPOS(ltTemp, ltWhatToGet); IF liPos > 0 THEN BEGIN ltTemp := COPYSTR(ltTemp, liPos + STRLEN(ltWhatToGet)); liPos := STRPOS(ltTemp, '&'); IF liPos = 0 THEN liPos := 999; ltReturnName := COPYSTR(ltTemp, 1, liPos - 1); END ELSE BEGIN CASE ltWhatToGet OF 'servername=' : ltReturnName := '<local>'; 'database=' : BEGIN lrSession.SETRANGE(lrSession."My session", TRUE); IF lrSession.FIND('-') THEN ltReturnName := lrSession."Database Name"; END; END; END; EXIT(ltReturnName); //+AD.RM END;
Main Manu - OnOpen I call:
tServerName := ADGetServerDBInfo('servername=');
tServerType := ADGetServerDBInfo('servertype=');
tDatabaseName := ADGetServerDBInfo('database=');
...to show data on 3 controls. Of course you can put a function call directly in source expression®obi
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯0 -
Thanks a lot for your help!
I am able to solve the problem now...ProTAKT Projekte & Business Software AG
Microsoft Dynamics NAV Partner
Bad Nauheim, Germany
http://www.protakt.de
http://twitter.com/protakt0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 328 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
