We're developing a COM-aware .Net assembly that is used in a legacy VB6 app and keep getting the above message when opening a connection via SDKInstanceManager.Instance.OpenDatabase
. When we call our method from inside another .Net assembly this does not happen, the call to open works fine. Below is the class we use:
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.AutoDual)]
[ComSourceInterfaces(typeof(IMyClass_ThreadedEvents))]
[Guid("A8F518D8-6446-11E2-BC88-724F6188709B")]
public class MyClass : IDisposable
{
public string OpenConnection()
{
string retVal = string.Empty;
try
{
retVal = "OpenConnection|@@|*NOERROR*|@@|*ALLOK*|@@||@@|";
string conInstallFolder = @"C:\Users\Public\Documents\Simply Accounting\2017\Samdata\Pro";
string conCompany = "Universl";
string conUserName = "sysadmin";
string conPassword = "12345";
string conVersName = "Sage 50 Accounts";
string conVersNumber = "2017";
string conVersCountry = "Canada";
bool allok = SDKInstanceManager.Instance.OpenDatabase(conInstallFolder + @"\" + conCompany + ".SAI", conUserName, conPassword, true,
conVersName + " " + conVersNumber + " " + conVersCountry, "SASDK", 1);
}
catch (Exception ex)
{
retVal = "OpenConnection|@@|*ERROR*|@@|" + ex.Message;
}
return retVal;
}
}
My VB6 code:
Private Function RunTestTasks()
Dim MyClass As New MyDLL.MyClass
Dim retval As String
retval = MyClass.OpenConnection()
Call MyClass.CloseConnection
Set MyClass = Nothing
End Function
The .Net assembly only references Sage_SA.SDK
, Sage_SA.Domain
and Sage_SA.Domain.Utility
and targets x86. No instances of Sage or app is accessing the company file. The VB6 code runs as Windows administrator.
Is there anything we're missing? We're stuck and would like to fix this issue. Many thanks.
Please note this has also been posted on the Sage Canada Community forum.