mibuso.com

Microsoft Business Solutions online community
It is currently Mon May 20, 2013 9:14 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: [Solved] How to get server and database name from C/SIDE
PostPosted: Thu Aug 07, 2008 8:29 am 
Offline

Joined: Thu Jul 17, 2008 9:42 am
Posts: 6
Location: Szczecin
Country: Poland (pl)
Hi, what is a best way to get server address and database name of current connection from C/SIDE (database on SQL)?

I found that way:
Code: Select all
//svr Record Server
//db Record Database

srv.FINDFIRST;
WHILE NOT srv."My Server" DO
  srv.NEXT;


dbs.FINDFIRST;
WHILE NOT dbs."My Database" DO
  dbs.NEXT;

Message(srv."Server Name");
Message(dbs."Database Name");


The problem is, that this method spend several second.
Anyone know better way to do this?


Last edited by zyyraf on Thu Aug 07, 2008 9:47 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 07, 2008 8:40 am 
Offline

Joined: Fri Apr 01, 2005 3:05 pm
Posts: 171
Location: IJsselstein
Country: Netherlands (nl)
Try using the search ...

Or CONTEXTURL system variable.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 07, 2008 9:05 am 
Offline

Joined: Mon Mar 08, 2004 2:42 pm
Posts: 3255
Location: Hannover
Country: Germany (de)
These are examples to get the database name / Servername

Code: Select all
RecDB.SETRANGE("My Database",TRUE);
RecDB.FINDFIRST;
DBName := RecDB."Database Name";

RecServer.SETRANGE("My Server",TRUE);
RecServer.FINDFIRST;
ServName := RecServer."Server Name";


or

Code: Select all
MyContext := CONTEXTURL;
message('Servername = %1\'+
        'Database = %2',(copystr(MyContext,StrPos(MyContext,'servername') + 11,
                        StrPos(MyContext,'&data') - StrPos(MyContext,'servername')-11)),
                        (copystr(MyContext,StrPos(MyContext,'&data') + 10,
                         StrPos(MyContext,'&company') - StrPos(MyContext,'&data')-10)));

_________________
Do you make it right, it works too!


Last edited by garak on Thu Sep 18, 2008 8:14 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 07, 2008 9:42 am 
Offline

Joined: Thu Jul 17, 2008 9:42 am
Posts: 6
Location: Szczecin
Country: Poland (pl)
Thank you very much :) - CONTEXTURL is excellent for my need.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 18, 2008 10:48 am 
Online
Moderator
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Wed Jul 02, 2003 10:13 am
Posts: 7493
Location: Milan
Country: Italy (it)
[Topic moved from Navision forum to Navision Tips & Tricks forum]

_________________
Regards,Alain Krikilion
Use the SEARCH,Luke! || No PM,please use the forum. || May the <SOLVED>-attribute be in your title! || Read Forum Rules before making a posting


Top
 Profile  
 
 Post subject: Re: [Solved]How to get server and database name from C/SIDE
PostPosted: Thu Oct 02, 2008 9:02 pm 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6977
Location: L.I., New York
Country: United States (us)
With this post & other you can get something like this
Sorry for my Old School Menu :oops:


Attachments:
OldSchoolMenu.JPG
OldSchoolMenu.JPG [ 46.35 KiB | Viewed 1556 times ]

_________________
Harry Ruiz
http://www.cosmeticsolutions.com
http://www.autismspeaks.org
Top
 Profile E-mail WWW  
 
 Post subject: Re: [Solved]How to get server and database name from C/SIDE
PostPosted: Thu Oct 02, 2008 9:15 pm 
Offline

Joined: Mon Mar 08, 2004 2:42 pm
Posts: 3255
Location: Hannover
Country: Germany (de)
:shock: who are the girls ???? :lol:

_________________
Do you make it right, it works too!


Top
 Profile  
 
 Post subject: Re: [Solved]How to get server and database name from C/SIDE
PostPosted: Thu Oct 02, 2008 9:28 pm 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6977
Location: L.I., New York
Country: United States (us)
We're a Beauty Supplier
3 Hot chicks - anybody got a better logo? 8) :lol: :mrgreen:

www.CosmeticSolutions.com

http://www.amazon.com/b/105-1417815-454 ... 54EXMVZHXW

_________________
Harry Ruiz
http://www.cosmeticsolutions.com
http://www.autismspeaks.org


Top
 Profile E-mail WWW  
 
 Post subject: Re: [Solved]How to get server and database name from C/SIDE
PostPosted: Thu Oct 02, 2008 9:35 pm 
Offline

Joined: Mon Mar 08, 2004 2:42 pm
Posts: 3255
Location: Hannover
Country: Germany (de)
for my person, i can't work with "chicks" like these in my firm
... i'm ever distracted =P~ (jammi)

:mrgreen:

_________________
Do you make it right, it works too!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: