cancel
Showing results for 
Search instead for 
Did you mean: 

Setting initial values on structures

Former Member
0 Kudos

I have written a middle-ware wrapper which allows me to call a SAP RFC from SQL Server stored procedures. I am upgrading it from the DCOM to the .Net connector so I can run it on Windows 2003 Server.

When I set a string value (SAP C type) to initial I get the error "Object reference not set to an instance of an object." raised in the proxy object. This error does not happen for non-initial values, and also does not happen on my development workstation. It happens if I set the string to "" or to " ". It occurs on two servers - Windows 2000 and Windows 2003.

I can't figure out how to debug this, and can't find anything in this forum or on SAP Notes. Has anyone else found this error?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Setting a value to a string member will always work if the containing structure is a valid object. Please check if the structure reference is null?

Can you paste a piece of your code?

Regards,

Guanwgei

Former Member
0 Kudos

A clear head in the morning makes all the difference. There was no problem with the .Net Connector.

The problem lay with SQL Server's sp_OAMethod procedure, or possibly in the .Net component's CCW. If you pass an empty string in as an argument, your component gets a Nothing. I therefore fixed it in the component with:

If Value Is Nothing Then Value = ""

Thanks,

Derek