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 : 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;
I have this function on Main Menu with 3 text variables:
Comments
Peter
It looks like...
http://freeweb.siol.net/saromo/ADGetServerDBInfo.jpg
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯