# Invalid assignment. It is not possible to assign a \_Recordset to a Recordset.

**URL:** <https://www.dynamicsuser.net/t/invalid-assignment-it-is-not-possible-to-assign-a-recordset-to-a-recordset/59027>\
**Category:** Developers Forum\
**Created:** [November 5, 2015, 9:07pm UTC](https://www.dynamicsuser.net/t/invalid-assignment-it-is-not-possible-to-assign-a-recordset-to-a-recordset/59027 "2015-11-05T21:07:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![archer89](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@archer89](https://www.dynamicsuser.net/u/archer89)\
**Post date:** [November 5, 2015, 9:07pm UTC](https://www.dynamicsuser.net/t/invalid-assignment-it-is-not-possible-to-assign-a-recordset-to-a-recordset/59027/1 "2015-11-05T21:07:20Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![thomasbrodkorb](https://avatars.discourse-cdn.com/v4/letter/t/2acd7d/32.png) [@thomasbrodkorb](https://www.dynamicsuser.net/u/thomasbrodkorb)\
**Post date:** [November 6, 2015, 7:43am UTC](https://www.dynamicsuser.net/t/invalid-assignment-it-is-not-possible-to-assign-a-recordset-to-a-recordset/59027/2 "2015-11-06T07:43:46Z")

</div>

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);

---

<div class="post-metadata">

**Author:** ![archer89](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@archer89](https://www.dynamicsuser.net/u/archer89)\
**Post date:** [November 6, 2015, 9:53am UTC](https://www.dynamicsuser.net/t/invalid-assignment-it-is-not-possible-to-assign-a-recordset-to-a-recordset/59027/3 "2015-11-06T09:53:42Z")

</div>

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;

😃

---

<div class="post-metadata">

**Author:** ![thomasbrodkorb](https://avatars.discourse-cdn.com/v4/letter/t/2acd7d/32.png) [@thomasbrodkorb](https://www.dynamicsuser.net/u/thomasbrodkorb)\
**Post date:** [November 6, 2015, 10:39am UTC](https://www.dynamicsuser.net/t/invalid-assignment-it-is-not-possible-to-assign-a-recordset-to-a-recordset/59027/4 "2015-11-06T10:39:09Z")

</div>

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