A question was posted on the Sage newsgroups for determining if the web site is connected to either a remote or office database. I gave it some quick thought and felt the best test would be to determine the database that the site was connected to. To solve this problem I wrote the following code;


public bool IsRemote()
    bool result = false;
    Sage.Platform.Data.IDataService service = ApplicationContext.Current.Services.Get<Sage.Platform.Data.IDataService>();
    if (service != null)
        System.Data.OleDb.OleDbConnectionStringBuilder builder = new System.Data.OleDb.OleDbConnectionStringBuilder(service.GetConnectionString());
        string databaseName = (string)builder[“Initial Catalog”];

        if (“slxremote”.Equals(databaseName, StringComparison.InvariantCultureIgnoreCase))
            result = true;

    return result;





  1. I would check the systeminfo:dbtype instead as not all users have SLXRemote as there remote database name… Most yes but not all.

    The other upside for doing it this way is that you can tell what type of remote database it is as well.

    1 = Main Office Database
    2 = Remote User Database
    3 = Remote Office Database (This one from memory)

    Hope this helps

  2. Absolutely, Thanks Chris. I have updated my post in the News Groups yesterday to reflect this. I appreciate you adding this detail.

Leave a Reply