EstablishDBConnectionWRefresh(pRefreshConnection); IF NOT ISCLEAR(ADOCommand) THEN // Recreate Command object CLEAR(ADOCommand); CREATE(ADOCommand); ADOConnStatus := MFLADOConnection.State; ADOConnString := MFLADOConnection.ConnectionString; MFLADOConnVariant := MFLADOConnection; ADOCommand.ActiveConnection := MFLADOConnVariant; //THIS LINE BLOWS ADOCommand.CommandText := pMainCommand + pArguments; ADOCommand.CommandType := StrToInt(pCmdType); ADOCommand.CommandTimeout := 0; CREATE(tmpADORecordSet); tmpADORecordSet.Open(ADOCommand);Note that this code works perfectly fine with NAS and has worked for years now, but when calling this code through a webservice call it blows on the marked (commented) line. I get the failure "The expression Variant cannot be type-converted to string".
Comments
ADOCommand.ActiveConnection := MFLADOConnection;
Also I don't see in your code making the connection.
MFLADOConnection.ConnectionString := 'sql blah blah';
MFLADOConnection.Open;
I'm guessing you just omitted it from the post.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Yeah, you're right. I do the preparation of the connection objekt in another function trigger. It works running through NAS so I guess it should be OK.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
We have the same problem. If we try the codeunit who uses ADO in a form no problem if we use it as webservice like
textBox2.Text= NAVWebService.LastlocationTractor(textBox1.Text);
we receive an error
System.Web.Services.Protocols.SoapException was unhandled
Message=The expression Variant cannot be type-converted to a String value.
Source=System.Web.Services
Actor=""
Lang=nl-BE
http://mibuso.com/blogs/ara3n/2011/01/1 ... tc-in-nav/
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
This works in both Classic and RTC