I am writting a dll and want to return a result back to the calling code.
I have tried putting:-
public string oSQL2XStreamBridge( string Name)
public class string oMyDll
both of which it does not like...

the code below errors because there is a return statment and it says you can't have a return statement when it is set to void. but it will not let me set it to string (as above)

public class oMyDll
        public oSQL2XStreamBridge( string Name)                                    
            string ResultMess = "";

   	   // work code goes here

            return "Test";

How do I get the result back to the calling code?


8 Years
Discussion Span
Last Post by nick.crane

You haven't declared the return type in your method definition.

A standard definition is <accessor> <return type> <method name>([<parameter type> <parameter name>]...) So; public int AddUp(int numberOne, int numberTwo) { return (numberOne + numberTwo); }


You said that public string oSQL2XStreamBridge( string Name) does not work.
What (and where) is the calling code?
If it is remote, then a string might not be returned as you expect.
Try with an Int type first to see if that works.

Edited by nick.crane: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.