ADO Recordset & Stored Procedure

I am writing a function to call a SQL store procedure and then go the the recordset in Navision. It works perfectly if I call a stored procedure with one paramater. However, if I call a stored procedure with two paramters no recordset is returned and the error is: “…Operation is not allowed when the object is closed”? I tested these stored procedures in Query Analyzer and know they work, it just seems there is a problem with how I am using my ADO. Heres my Variables: CON ‘Microsoft ActiveX Data Objects 2.7 Library’.Connection RS ‘Microsoft ActiveX Data Objects 2.7 Library’.Recordset And a rough sample of my code: SQL := exec Stored_Procedure ‘Par1’, ‘Par2’ RS := CON.Execute(SQL); //RS := CON.EXECUTE(SQL,VAR,8); IF NOT RS.EOF then … If anyone has any ideas it would be greatly appreciated. Thanks

Chaps, Ive found it. After trying ADO.COMMAND, ADO.PARAMETER etc I still had the same results. So this led me to thinking “it’s the stored procedures at fault”… SET NOCOUNT ON must be called at the beginning of the procedure and SET NOCOUNT OFF at the end of the procedure. This has an affect on the recordset returned. :slight_smile:

Moved to SQL Forums…