Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored Proc returning Recordset? 1

Status
Not open for further replies.

WTL

MIS
Jul 4, 1999
5
CA
Hello and thanks for your input<br><br>I've written a sp like this <br><br>create proc sp_myproc (@value1 int,@value2 int)<br>as<br><br>INSERT titles (value1,value2)<br>VALUES (@value1,@value2)<br><br>-- followed by<br><br>SELECT * FROM titles<br>return<br><br><br>/* I would like to return the select statement to an ADO&nbsp;&nbsp;&nbsp;recordset; the insert works but the recordset is not returned in ADO<br><br>How should this be done -- thanks<br><br>Regards<br>Andre S.<br>*/
 
Andre,<br><br>You might find that you are returning two records sets from the stored procedure. The first recordset will be the output from the insert statement ( ie. 1 row inserted). The next recordset will contain your SELECT statement. Try either putting the command 'SET NOCOUNT ON' in your stored procedure to prevent the SP from returning the count OR use the ADO method 'NextRecordset' to retrieve the contents of the SELECT statement.<br><br>Hope it helps<br><br>CD
 
Thanks very much for the acurate advice 'cdukes'. I think you likely saved me several hours of hunting through the online books.<br><br>I will likely have more questions in the near future and hope you will respond again.<br><br>Thanks again<br><br>Best Regards<br><br>Andre
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top