As you likely know, the connection string for the SalesLogix OLE DB Provider changes for version 6.2 of SalesLogix. Now your custom applications that use a connection via the provider will need to be changed. But what about applications that need to be able to work with both versions - for example a commercial application? Sure, you could release two different versions of your application, but why? This article will look at how you can make your applications smart enought to determine which version of the SalesLogix Provider is installed.
Building custom applications for SalesLogix requires you to use a connection string via the SalesLogix Provider. When Version 6.2 was released, the connection string format changed which would break applications that use a connection string. If your application might be used by users on both 6.1 and 6.2 you have a few options to think about.
Of course option 2 is the way to go. This allows your application to be dynamic and you don't have the burder of supporting two different versions of your software.
- Hard code the different connection strings and release two versions of your application (one for the 6.2 users and one for the 6.1 users)
- Determine at run time which version of the SalesLogix Provider is installed and then use a connection string formatted for that version.
It is easy enough to read the registered provider information from the registry to detect the version of the SalesLogix provider at run time and then use the appropriately formatted connection string. Why would we not just check the version of the Sales Client that is installed? Because you might not always have the Sales Client installed, such as in the case of a server application. So we will look in the registry where the provider will be registered and then allow our application to drive on.
This sample C# code will return the version of the SalesLogix provider installed.
public enum SalesLogixVersion
public SalesLogixVersion ProviderVersion
//We'll default to 6.1
SalesLogixVersion ver = SalesLogixVersion.Version61OrPrior;
RegistryKey key = null;
key = Registry.ClassesRoot.OpenSubKey("SLXNetwork.1");
if (key != null) ver = SalesLogixVersion.Version61OrPrior;
key = Registry.ClassesRoot.OpenSubKey("SLXOLEDB.1");
if (key != null) ver = SalesLogixVersion.Version62;
if (key != null) key.Close();
Of course, in your application you would use this logic to determine the version of the SalesLogix Provider installed so you can modify the connection string accordingly.
if (ProviderVersion == SalesLogixVersion.Version62)
// use a version 6.2 formatted connection string
// use a version 6.1 or prior connection string
Making your applications smart enough to find out information, such as the version of SalesLogix installed will go a long way with your customers. Not only that but it will free you from having to support multiple versions of the application. Don't do things any other way.
Until next time, happy coding.
Article originally posted at: http://saleslogixblog.com/rfarley/archive/2004/08/06/946.aspx