prademaker
6th July 2005, 19:01
Dear Baanfriends,

I'm trying to figure out how to connect to Baan using VB.

I've created a DLL in which I have a simple function:

function extern domain tcmcs.str80 zoslsdllvbbaan.find.order(
domain tcorno i.orno, domain tcpono i.pono)
{
select tdsls041.*, tdsls040.*, tccom010.*
from tdsls041, tdsls040, tccom010
where tdsls041._index1 = { :i.orno, :i.pono }
and tdsls041.orno refers to tdsls040
and tdsls040.cuno refers to tccom010
selectdo
selectempty
return("Not a valid order")
endselect

return( strip$(tccom010.nama) )
}

From VB6 I execute this function:

B_function = "zoslsdllvbbaan.find.order" & "("
B_function = B_function & Text3.Text & ", "
B_function = B_function & Text4.Text & ")"
BaanObj.ParseExecFunction "ozoslsdllvbbaan", B_function

In debug-mode i checked that the right salesorder/customer is found, however I can't manage to get the returned value from the function into VB.

Can anyone tell me how I should do this?

shaboo
6th July 2005, 20:29
Normally the way I do is that I do not define any return type for the function. Rahter I would define the function with couple of parameters with ref designator and then set those up as indicator of success or failure. For example your function would look something like

function zoslsdllvbbaan.find.order(
domain tcorno i.orno,
domain tcpono i.pono,
ref domain tcmcs.str3 o.error.code,
ref domain tcmcs.str215 o.error.desc)
{ ..........

and in the function I will set the values of error.code and description and then these values are accessible once the function call is done.

I have never used this using VB/AFS directly but it works just fine with OpenWorld.

Hope it helped

prademaker
6th July 2005, 21:28
Sure it helped!

Now the result of "BaanObj.FunctionCall" includes the expected data.

Thanks for the quick reply.