|
-
February 28th, 2005, 03:27 PM
#1
CRecordSet and stored procedure that returns a recordset
Hello,
I have a very simple stored procedure:
Code:
CREATE PROCEDURE sp_getcurrentmonth
AS SELECT TOP 1 month_id FROM lockdown_schedule WHERE lockdown_date + 7 > GETDATE() ORDER BY lockdown_date asc
GO
When I execute the procedure in the query analyzer, it returns 1 row with the number I'm expecting.
However when I use the CRecordset open:
m_rs.Open(CRecordset::forwardOnly,"EXECUTE sp_getcurrentmonth",CRecordset::executeDirect|CRecordset::readOnly)
it crashes. Running through the debugger I can see that this is because m_nFields is 0.
Am I missing a step here? Why would the number of fields be zero? it should be one.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|