Hopefully an easy one - Failed to load the ProvideX library

We have no issues loading the ProvideX library with Sage 100 Advanced, however we're having an issue with Sage 100 Premium (SQL).

We use the following c# code. It appears we're getting an error when it tries to invoke the Init method.  Stack trace is below.  Any ideas?  Could it be we need to change the param we used for Sage 100 Advanced to something else?  

public bool Connect()
{
    if (this.IsConnected)
        return true;

    try
    {
        this.ProvideX = new DispatchObject("ProvideX.Script");
        if (this.ProvideX.Object == null)
            throw new NullReferenceException(Resources.CorruptOrMissingInstallation);

        this.ProvideX.TryInvokeMethod("Init", ProgramDirectory);

        this.Session = new DispatchObject(this.ProvideX.TryInvokeMethod("NewObject", "SY_SESSION"));

        this.IsConnected = this.SetUser() && this.SetCompany();
    }
    catch (COMException comex)
    {
        throw new ApplicationException(Resources.CorruptOrMissingInstallation, comex);
    }
    return this.IsConnected;
}

private static string ProgramDirectory
{
	get
	{
		RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\ODBC\\ODBC.INI\\SOTAMAS90");
		return key == null ? string.Empty : key.GetValue("Directory") + "\\Home";
	}
}

Stack Trace

Type            : System.Reflection.TargetInvocationException

Message         : Exception has been thrown by the target of an invocation.

Source          : mscorlib

StackTrace      :

   at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)

   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)

   at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args)

   at PalMate.Integration.MAS90.Integration.Core.ProvideXObject.TryInvokeMethod(Object value, String methodName, Object[] parameters)

   at PalMate.Integration.MAS90.Integration.Core.DispatchObject.TryInvokeMethod(String methodName, Object[] parameters)

   at PalMate.Integration.MAS90.Mas90Plugin.Connect()

   at PalMate.Integration.Program.Main(String[] args)

Type            : System.Runtime.InteropServices.COMException

Message         : Failed to load the ProvideX library

Source          : ProvideX.Script.1

Parents
  • 0

    You will need to reevaluate the code for your property ProgramDirectory. Have a feeling that its returning null as the SOTAMAS90 DSN won't be there for a Premium (SQL) install. An alternative to your code.

            private static string ProgramDirectory
            {
                get
                {
                    using (var baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32))
                    {
                        using (var subKey = baseKey.OpenSubKey(@"Software\Sage Software\BIE Explorer\Products\MAS90", false))
                        {
                            var value = subKey.GetValue("ViewsPath", string.Empty).ToString();
    
                            if (!string.IsNullOrEmpty(value))
                            {
                                var pos = value.LastIndexOf("MAS90", StringComparison.OrdinalIgnoreCase);
    
                                if (pos > 0) value = value.Substring(0, pos + 5);
                            }
    
                            return value;
                        }
                    }
                }
            }

  • 0 in reply to Russell Libby

    That worked however we're now running into additional issues. This is interesting because our integration works just fine with Sage 100 (Mas90) std/adv but not with Premium. Is there a document you can point me to that lists any BOI differences between the two products?  Meanwhile we will install the Advanced version and install with the same data file from our application to ensure it's not a "setup" issue. The error we're receiving from our application is 'Could not set key 'CustomerNo$' with value '0000007'."  when integrating AR invoices (same is true for AP invoices but is displays VendorNo$). Our test team mentioned they double checked the customer number to ensure it was valid however it appears to me that's the issue. How do we ensure the customer/vendor number is valid?

  • 0 in reply to Patrick1

    Customer and vendor numbers have a two field key, always, including A?DivisionNo.  If divisions are not enabled, hard code to "00".

  • 0 in reply to Kevin M

    Thank you for the reply Kevin. Is there a document/page available that lists the BOI differences between Std/Adv and Premium? 

  • 0 in reply to Patrick1

    AFAIK there shouldn't be any differences for the BOI interface at the object / data structure level. 

    How you connect might be different, but that's beyond my area of expertise.

Reply Children
  • 0 in reply to Kevin M

    We tested the same data in our application with a fresh install of Sage 100 Advanced and it worked just fine. There must be a setup difference in Premium vs Advanced or its a code issue on our end. We again installed a fresh copy of Premium and the test team double checked the customer number. Our test team said the error message doesn't have the full customer number regardless if they setup divisions or not. For example the customer No in our app is "020000001". The customer integrates just fine into Sage 100. When integrating an AR invoice it returns the error above but references a customer No "0000001".  Does this provide any clues as to where the issue lies?