Mega Code Archive

 
Categories / Delphi / ADO Database
 

Sybase ctlib, multiple stored procedure result sets

Question: I wish to return result set from multiple stored procedures or open tables/tqueries after returning results from a stored procedure but receive this error instead: ct_send(): user api layer: external error: This routine cannot be called because another command structure has results pending. What can I do to avoid this error? Answer: Sybase (CTLIB SYBSSC32.DLL) SQL Links Driver, BDE 4.x Solution: Use a tquery to "open" the stored procedure. (For additional info please see the topic on Sybase in the BDE32.HLP file by using the help file Index tab to search for SYBASE) Delphi Example: Add "BDE" to your unit's uses clause Button Click procedure to open results from a Tquery ("exec storedproc"): procedure TForm1.Button2Click(Sender: TObject); begin query1.prepare; dbisetprop(hdbiobj(query1.StmtHandle),stmtEXECASCURSOR,1); query1.open; In this example: the StoredProc name is LINEITEM_RSLT: CREATE PROCEDURE LINEITEM_RSLT AS ( SELECT * FROM lineitem ) Tquery1 sql strings for this example would be: exec LINEITEM_RSLT