cancel
Showing results for 
Search instead for 
Did you mean: 

SAPConnection overloaded constructor error

Former Member
0 Kudos

Hi.

I am using NCo ver 2.0.1.

I am developing a VB.NET application.

I create a ConfigDestination object, by reading connection parameters from the <i>.config</i> file.

After that (in debug mode) i check the <b>ConfigDestination.ConnectionString</b> property and I verify it is correct.

So I create a <b>SAPConnection</b>, using the overloaded constructor accepting a IDestination object.

fter that (in debug mode) i check the <b>SAPConnection.ConnectionString</b> but it is an empty string.

Here's the code (VB)

'get Destination from configuration file 'app'.config

_SapConfigDestination = New SAP.Connector.ConfigDestination("testSectionName")

'creates a connection object

SapConnection = New SAP.Connector.SAPConnection(SapConfigDestination)

Logger.Write(CObj("Connection created"), ctCategory, 0, 0, Severity.Information)

'instantiate proxy object

Proxy = New SAPProxy(SapConnection.ConnectionString)

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thank you very much, this solves the problem.

Still I can't' understand the reason why the connection string is not embedded transmitted from the Destination object to the SAPConnection object and to the SapProxy object.

These classes have the ConnectionString property which returns an empty string after these passages.

reiner_hille-doering
Active Contributor
0 Kudos

> Thank you very much, this solves the problem.

What's about assigning some reward points?

> Still I can't' understand the reason why the

> connection string is not embedded transmitted from

> the Destination object to the SAPConnection object

> and to the SapProxy object.

>

> These classes have the ConnectionString property

> which returns an empty string after these passages.

I can't also really understand what happens here. The SAPConnection's ConnectionString property is only reset (intentionally) to empty string, when the connection is closed. I don't see when this happens in your code, maybe somehow through the GC.

Anyway, your original code didn't make so much sense, because you in fact would create two SAPConnections: One explictly and another one implicitly by passing a connection string to the constructor of your proxy. Only the second one would then be used anyway. Note that the SAPConnection is really the active connection - the thing that has the socket open.

reiner_hille-doering
Active Contributor
0 Kudos

_SapConfigDestination = New SAP.Connector.ConfigDestination("testSectionName")

Now either:

SapConnection = New SAP.Connector.SAPConnection(SapConfigDestination)

_Proxy = New SAPProxy()

_Proxy.Connection = _SapConnection

Or:

Proxy = New SAPProxy(SapConfigDestination.ConnectionString)