blah blah blah is here! blah blah » Close

up0down
link

Hi,

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?

Thanks

last answered one year ago

1 answers

up0down
link

If the method returns a string then it's signature should indicate this:

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

// work code goes here

return "Test";
}
}

// to call from a client of the dll
oMyDll omd = new oMyDll();
string result = omd.oSQL2XStreamBridge("Fred");

What do you mean when you say that it does not like 'public string oSQL2XStreamBridge( string Name)'? What error do you get?

Feedback