|
-
August 17th, 1999, 08:46 AM
#1
CRecordset
I am getting the following error message when trying to call the stored procedure. This stored procedure returns me the record. Is there any syntax error in calling the sp. Please suggest solution at earliest.
0042113C : Cannot open a cursor on a stored procedure that has anything other than a single select statement in it.
BOOL GetParticipantList(void)
{
CString sqlString;
char scheduleKey[10];
CRecordset participantList(&dbEasyDiary);
itoa(5748, scheduleKey, 10);
sqlString.Format("{CALL sp_getUsersInAppointment(5748, 0)}");
// sqlString = "{CALL sp_getUsersInAppointment('" + scheduleKey + "')}";
try
{
participantList.Open(CRecordset::snapshot, (LPCTSTR)sqlString, CRecordset::readOnly );
}
catch(CDBException *e)
{
char str[1024];
e->GetErrorMessage(str, 1024);
cout << "Error: " << e->m_strError << " : " << str << endl;
cout << "Failed Open() : GetParticipantList" << endl;
return FALSE;
}
long numberOfParticipants = participantList.GetRecordCount();
if (numberOfParticipants == -1)
{
cout << "GetParticipantList Failed 2 !!!" << endl;
return FALSE;
}
CDBVariant userKey, isInitiator, firstName, lastName, eMail;
participantList.MoveFirst();
while (!participantList.IsEOF())
{
participantList.GetFieldValue("UserKey", userKey);
participantList.GetFieldValue("IsInitiator", isInitiator);
participantList.GetFieldValue("FirstName", firstName);
participantList.GetFieldValue("lastName", lastName);
participantList.GetFieldValue("eMail", eMail);
cout << userKey.m_pstring << " ";
cout << isInitiator.m_iVal << " ";
cout << firstName.m_pstring << " ";
cout << lastName.m_pstring << " ";
cout << eMail.m_pstring << endl;
}
return TRUE;
}
-
August 17th, 1999, 10:15 AM
#2
Re: CRecordset
Are you sure that in your Store Procedure there are nos insert, update or delete.
With the error message I will look in the store procedure and not in the C++ code
Christian Niquille
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
|