Hasan Mahboob Posted January 8 Posted January 8 I tried to connect SAGE 200 from a Windows App. It was working as accepted but all of sudden a threw an exception. It is the code used to connect. public string Connect(string companyName) { application = null; try { application = new Sage.Accounting.Application(); application.Connect(); foreach (Sage.Accounting.Company item in application.Companies) { if (item.Name == companyName) { application.ActiveCompany = item; } } if (application.ActiveCompany == null) throw new SageServiceException($"The configured company name {companyName} could not be found in Sage Financials"); return application.ActiveCompany.Name; } catch (Exception ex) { string inner = ""; if (ex.InnerException != null) inner = ex.InnerException.Message; throw new SageServiceException(ex.ToString() + Environment.NewLine + Environment.NewLine + inner); } } And this is the exception System.TypeInitializationException: The type initializer for 'Sage.Accounting.Application' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Sage.MMS.SAA.Client, Version=19.0.0.0, Culture=neutral, PublicKeyToken=b2daa66d74953d11' or one of its dependencies. The system cannot find the file specified. at Sage.Accounting.Application..cctor() --- End of inner exception stack trace --- at Sage.Accounting.Application..ctor() at SageLibrary.SageService.Connect(String companyName) in C:\Sage\HuntersSageImporter\SageLibrary\SageService.cs:line 24 Could not load file or assembly 'Sage.MMS.SAA.Client, Version=19.0.0.0, Culture=neutral, PublicKeyToken=b2daa66d74953d11' or one of its dependencies. The system cannot find the file specified. Any idea.
Administrators Ben Smith Posted January 29 Administrators Posted January 29 Hi Hasan, This query references the use of the Sage 200 SDK, which is licenced and support is provided to members of the UK Developer Programme. If you would like to be a member, or are already please forward this query to [email protected]. Thanks, Ben 1
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now