I'm trying to use wwDotNetBridge to interface with Sage 200 accounts (.net 3.5). I'm failing at almost the first hurdle - logging on to Sage 200.
Having loaded the relevant Sage 200 assemblies, I then do this:
LOCAL oApplication As Sage.Accounting.Application cName = 'TEST2' cPass = 'test2' oApplication = oBridge.CreateInstance('Sage.Accounting.Application') oBridge.InvokeMethod(oApplication, 'Connect', cName, cPass)
... which follows this VB.Net code example:
' Declare the Application object used to connect. Dim application As Sage.Accounting.Application = Nothing application = New Sage.Accounting.Application ' Use the Connect method passing the username and password as strings) application.Connect("John", "orange")
Superficially this works (ie no error thrown) and if I open the Sage 200 Admin Console TEST2 is shown as an active user. However, the logon has in fact failed. When I dig around, I find that Sage.MMS.SAA.Client.ConnectionState returns 0 (not logged on) and the message 'Unable to authenticate user'.
Sage support has this to say:
As you’re not getting any error back when you call Connect, I assume that the username and password are correct.
- Are you able to log into the client UI with those details?
- Are you running your code on a web service / web site or via a WPF application?
- Are you running our connection and activecompany code across different threads?
.. to which the answer is yes, no, no.
Can anyone shed any light on why this is failing?
Thanks