I am trying to connect to a production database from a C# console project in .NET6 with VS 2022 using this piece of code
using SAPbobsCOM;
void InsertarActividad()
Company oCompany = new Company();
oCompany.Server = "IP_Server";
oCompany.CompanyDB = "DEMO";
oCompany.UserName = "manager";
oCompany.Password = "XXXXXX";
oCompany.DbUserName = "sa";
oCompany.DbPassword = "XXXXXX";
oCompany.DbServerType = BoDataServerTypes.dst_MSSQL2012;
oCompany.LicenseServer = "IPServer:30000";
int rdoConexion = oCompany.Connect();
oCompany.StartTransaction();
try
{
In rdoConnection variable I get a value of -10 and according to other code examples I think the value should be 0 because when I start the transaction it tells me that I am not connected
System.Runtime.InteropServices.COMException: ‘You are not connected to a company’
The values of oCompany are correct and in fact in an old VB.NET application that I am migrating they work and I don't know the reason why now in the same local network of the office in this project it does not connect me
Any ideas, please?
Thanks