If you are using SQL-server then you can use the virtual table "Server" to retrieve the servername, and the virtual table "Session" to retrieve the databasename (but this is a performance killer).
PROCEDURE ADGetServerDBInfo@1000000001(ltWhatToGet@1000000003 :Text[30]) ltReturnName :Text[250];
VAR
ltTemp@1000000004 :Text[250];
liPos@1000000005 :Integer;
lrSession@1000000000 :Record2000000009;BEGIN// ADGetServerDBInfo//-AD.RM{Usage:CallADGetServerDBInfo('servername=') to GetServerNameCallADGetServerDBInfo('servertype=') to GetServerTypeCallADGetServerDBInfo('database=') to GetDatabaseNameCallADGetServerDBInfo('company=') to GetCompanyName}
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.RMEND;
I have this function on Main Menu with 3 text variables:
Comments
Peter
It looks like...
http://freeweb.siol.net/saromo/ADGetServerDBInfo.jpg
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯