i’m using activex component ADO 2.8 Library to call a sql stored procedures in a codeunit using
ADORecset := ADOConnection.execute(spCall …);
the codeunit is run by the NAS.
when the function with that command is started i get the error “Invalid assignment. It is not possible to assign a _Recordset to a Recordset.” in the windows eventlog. the execute command is not run, the sp is not executed. the processing stops at that point. any ideas ?
ADORecset must be Automation of Type ‘Microsoft ActiveX Data Objects 2.8 Library’._Recordset
What I do and that works:
SqlConn Automation ‘Microsoft ActiveX Data Objects 6.0 Library’.Connection
SqlCommand Automation ‘Microsoft ActiveX Data Objects 6.0 Library’.Connection
SqlRecordSet Automation ‘Microsoft ActiveX Data Objects 2.8 Library’._Recordset
CREATE(SqlConn);
SqlConn.Open(
STRSUBSTNO(‘Provider=SQLNCLI10;Server=%1;Database=%2;Uid=%3;Pwd=%4;’,
ServerName, DatabaseName, UserName, Password));
Command := ‘DECLARE @retValue int;’ +
STRSUBSTNO(‘EXEC @retValue = dbo.SendPostedDocument ‘’%1’’, ‘’%2’’, ‘’%3’’, ‘’%4’’, ‘’%5’’, ‘’%6’’;’,
…
SqlRecordSet := SqlConn.Execute(Command);
WHILE NOT SqlRecordSet.EOF DO BEGIN
RetValue := SqlRecordSet.Fields.Item(0).Value;
SqlRecordSet.MoveNext();
END;
EXIT( RetValue >= 0);
i tried your “solution”. didn’t work at all. got exactly the same error. 
but i found a real working solution.
AdoRecset.Open(SqlStatement, AdoConnection); instead of AdoConnection:Execute;

Weird one, I just extracted that code from a live customer where it is working in NAV 2009R2 (classic client).