Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8372

Problem connecting to a company

$
0
0

Hi,

 

I am using the following code to get a connection to a company

 

 

//  Initialize the Company Object.

            //  Create a new company object

            oCompany = new SAPbobsCOM.Company();

           

            //  Set the mandatory properties for the connection to the database.

            //  To use a remote Db Server enter his name instead of the string "(local)"

            //  This string is used to work on a DB installed on your local machine

 

 

            oCompany.Server = "TS0022-LAPTOP";

            oCompany.CompanyDB = "SBODemo_US";

            oCompany.UserName = "manager";

            oCompany.Password = "manager";

            oCompany.language = SAPbobsCOM.BoSuppLangs.ln_English;

            oCompany.DbUserName = "sa";

            oCompany.DbPassword = "SAPBUSINESSONE";

           

            int valor = oCompany.Connect();

           

            //  Check for errors during connect

            int transTemp6 = System.Convert.ToInt32( lErrCode );

            oCompany.GetLastError( out valor, out sErrMsg );

            if ( lErrCode != 0 ) {

                Interaction.MsgBox( sErrMsg, (Microsoft.VisualBasic.MsgBoxStyle)(0), null );

            }

            else {

                Interaction.MsgBox( "Connection Established", MsgBoxStyle.Information, null );

            }

 

 

but in this line:

int valor = oCompany.Connect();

           

I get -125, I search in the SAP Business One DI API 9.0 - Objects Reference (9.00.052)  GetLastError Method help and didnt find any information about this code.

 

What is wrong in my code?

 

Regards.


Viewing all articles
Browse latest Browse all 8372

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>