cancel
Showing results for 
Search instead for 
Did you mean: 

asp.net access - getting -111

0 Kudos

Hi,

how do i use asp.net to connect to sbo?

I have a small code example here but i keed getting a -111 result back.

public static SAPbobsCOM.Company sboCompany;

private void Page_Load(object sender, System.EventArgs e) {

sboCompany = new SAPbobsCOM.CompanyClass();

sboCompany.Server = "localhost";

sboCompany.UserName = "sa";

sboCompany.Password = "*****";

sboCompany.CompanyDB = "SBODemo_DK";

sboCompany.LicenseServer = "localhost";

sboCompany.language=BoSuppLangs.ln_Danish;

sboCompany.UseTrusted = true;

int result = -1;

result = sboCompany.Connect();

if (result != 0) {

TextBox1.Text = result.ToString();

}

}

Can any1 help me resolve this???

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

So it is impossible to have the database server on one machine, and use asp.net on another machine to access through sapbobscom?

Former Member
0 Kudos

This is the code I use to connect in an asp.net page:

Private Sub ConnectToCompany()

oCompany = New SAPbobsCOM.Company

oCompany.Server = "servername"

oCompany.CompanyDB = "databasename"

oCompany.UserName = "username"

oCompany.Password = "password"

oCompany.language = SAPbobsCOM.BoSuppLangs.ln_English

oCompany.Connect()

oCompany.GetLastError(lErrCode, sErrMsg)

If lErrCode <> 0 Then

Response.Write("error connecting to company: " & sErrMsg)

End If

End Sub

Former Member
0 Kudos

I don't know wheter this is a difference from programming with asp.net and vb6, but have you already tryed:

sboCompany.Server = "(local)";

instead of

sboCompany.Server = "localhost";

?

That's what I do in VB6.

Florian

0 Kudos

actually i am using my computers name.

but i just tried with both (local) and localhost and its still the same.

former_member185703
Active Contributor
0 Kudos

Peter,

Could it be that you confused UserName with DBUsername + Password with DBPassword?

regards,

Frank

0 Kudos

sboCompany = new SAPbobsCOM.CompanyClass();

sboCompany.Server = "ibm-peter";

sboCompany.CompanyDB = "SBODemo_DK";

sboCompany.UserName = "manager";

sboCompany.Password = "manager";

sboCompany.LicenseServer = "ibm-peter";

sboCompany.language=BoSuppLangs.ln_Danish;

sboCompany.UseTrusted = true;

dosent work....

sboCompany = new SAPbobsCOM.CompanyClass();

sboCompany.Server = "ibm-peter";

sboCompany.CompanyDB = "SBODemo_DK";

sboCompany.DbUserName = "sa";

sboCompany.DbPassword = "******";

sboCompany.LicenseServer = "ibm-peter";

sboCompany.language=BoSuppLangs.ln_Danish;

sboCompany.UseTrusted = true;

dosent work either...

0 Kudos

any ideas???

former_member185703
Active Contributor
0 Kudos

Hi Peter,

First FYI: Basically error -111 is returned whenever the logon to SBO-Common database failed (unfortunately for whatever reason) or a problem with table SINF in SBO-Common is encountered...

An idea which will most likely not be new to you, but I didn't find a remark whether or not you already tried that:

Did you try to use the logon parameters in an ordinary Visual Studio project - non-ASP.NET?

Did you check the version of DI API installed + the DB version (to be found in SINF; just for completeness: in company DBs this information is stored in CINF...)?

Regards,

Frank

0 Kudos

Finally i solved it - first of all i did not have an active period in the database i connected to.

Second i found out throught the forums that i needed to set the .net user ASPNET to the saplicense in component services and give it local activation.

And that was basically it - works like a charm now - excep a simple connection uses about 77 mb ram (pretty much in my mind).

former_member185703
Active Contributor
0 Kudos

Congratulations! Now you could think about using DI Server...

The problem with the active period is (asfaik) going to be fixed. Sorry, you were a bit too early.

Re memory:

This is because of all the libraries loaded in the background (OBServerDLL, XML parser,...) + all the meta data loaded.

R&D thinks about how this could eventually be improved some time in future...

Regards,

Frank

Former Member
0 Kudos

Hi Peter,

Can I know if your BO server is on ur local machine or not??Because I have this problem since long time...I tried to set the user ASPNET in the license server but it doesn't work ...Notice that this works locally, so if i put my webapplication on the server machine it works...

Could you explain for me exactly what did you do with the ASPNET user to solve the probleme??

Thanks...

0 Kudos

Hi Ola,

yes it was just on my local machine i tested it.

With the ASPNET user account i did the following:

start - control panel - administration - componentservices - expand komponentservices - expand computers - expand this computer - click DCOM configuration - right click SBOLicense and select properties - select security - under program run and activation click the button (not quite sure thats the name - i am on a danich machine) - and assign the ASPNET user account here and give it local activation and local start.

Former Member
0 Kudos

I get the same problem with VC++ 6.0.

the program was working fine. we had to reinstall the SQL server. the users were also recreated. we reinstalled the sdk and the good dll is registered.

i still get the -111

any ideas ?

thanks,

Jonathan

Former Member
0 Kudos

a workaround for the problem..

NOT WORKING: ( error -111 on connect )

sboCompany = new SAPbobsCOM.CompanyClass();

sboCompany.Server = "ibm-peter";

sboCompany.CompanyDB = "SBODemo_DK";

sboCompany.UserName = "manager";

sboCompany.Password = "manager";

sboCompany.UseTrusted = true;

WORKING:

sboCompany = new SAPbobsCOM.CompanyClass();

sboCompany.Server = "ibm-peter";

sboCompany.CompanyDB = "SBODemo_DK";

sboCompany.UserName = "manager";

sboCompany.Password = "manager";

sboCompany.DbUserName = "sa";

sboCompany.DbPassword = "******";

sboCompany.UseTrusted = false;

Former Member
0 Kudos

Is windows authentication activated on your SQL-server ?

If not then you can not use a "UseTrusted" connection.

Your workaround works fine then. One miner is that a password to the database is sitting in clear text in your code. But it works.

Greetings Danny.

Former Member
0 Kudos

If you upgrade to SAP 2004

You cannot run that application on a diferent server where you have your license installed...

Move your ASP Application to the same server where you install the license (maybe is the same server where you have your production database)

This is going to solve errors for:

1. Cannot connect to SBOCommon

2. Access is denied

This is the code that you have to use to connect to your data base

=============================================

Dim vCompany As SAPbobsCOM.Company

vCompany = New SAPbobsCOM.Company

vCompany.DbServerType = BoDataServerTypes.dst_MSSQL

vCompany.Server = "YOUR SAP-SERVER"

vCompany.CompanyDB = "YOUR DATABASE"

vCompany.UserName = "YOUR USER"

vCompany.Password = "YOUR USER PASSWORD"

vCompany.DbUserName = "YOUR DATABASE USER" '(sa)

vCompany.DbPassword = "YOUR DATABASE USER PASSWORD"

vCompany.UseTrusted = False

=============================================

good luck fellas