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