dbTalk Databases Forums  

How to get result sets from a batch?

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss How to get result sets from a batch? in the sybase.public.sqlanywhere.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Markus KARG
 
Posts: n/a

Default How to get result sets from a batch? - 11-18-2009 , 05:22 AM






Using Microsoft C++ we can query multiple result sets from a single stored
procedure call with code similar to this one:

CRecordset rs(&db);
rs.Open(CRecordset::forwardOnly, "{call PerformanceTest}",
CRecordset::readOnly);
for (int i = 0; i < j; i++) {
rs.FlushResultSet();
this->m_bar.SetPos(i);
}
rs.Close();

Now we lilke to query multiple result sets from a SQL batch, so we tried
doing this one:

CRecordset rs(&db);
rs.Open(CRecordset::forwardOnly, "BEGIN DECLARE ... SELECT ... END;",
CRecordset::readOnly);
for (int i = 0; i < j; i++) {
rs.FlushResultSet();
this->m_bar.SetPos(i);
}
rs.Close();

At runtime this results in an exception as the MFC class does not find the
list of columns (even if we provide rs.m_nFields = 2 before Opening).

What is the correct way to do this?

Thanks
Markus

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.