RE: Getting Return Values from Stored Procedures
Posted in 1998
Regarding getting stored values from stored procedures : I am not an expert on vbscripting, however I know enough to get my things solved, I am giving you the extract of the vbscript and the stored procedure for you to check and compare with your stored procedure and make the necessary changes... '--------------------------------------- ' establish database connection '--------------------------------------- Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open "Databasename", "user-id", "password" sql = "af_m_light();" ### (calling procedure) ### '--------------------------------------- ' create recordset - I don't know what this does but it works ' note 4 has to remain 4 irrespective ' of the number of returned values. ' 100 is the maximum number of rows returned '--------------------------------------- Set RS = Conn.Execute(sql, rowcount, 4) v = RS.GetRows(100) '--------------------------------------- ' build data strings '--------------------------------------- For row = 0 to UBound(v,2) #### UBound(v,2) is the number of rows returned. zmajcom = Trim(v(0,row)) #### v(0,row), v(1,row) etc are the values of the rows returned. The stored procedure would just say Return var1, var2 with resume. Hope this helps. ___________________________________________________________ Sunil Thakkar (sunil0@hotmail.com) Informix DBA Last seen: Consulting at US-AirForce, Texas. _____________________________________________________________ There is always a simple way of solving complicated problems. -----Original Message----- From: Michael W. Lester [mailto:lesterm@usaa.com] Sent: Thursday, May 28, 1998 8:49 AM To: informix-list@iiug.org Subject: Getting Return Values from Stored Procedures Help! I am unable to get return values from a stored procedure back to a VB client connecting thru ODBC. (I've experienced this with both 16 bit INET / ODBC and 32 bit IConnect / Intersolv ODBC 3.0 using VB 3.0, VB 4.0 32 bit, and VB 5.0. My version of OnLine is 5.0. ) If I use the following VB code, I can capture the 1st return value, but other columns come back null even though the function returns actual values. '--------------------------------------------------------------------------- ---------------- 'VB 4.0 or greater code set rs = db.openrecordset("execute procedure this_bytes( parm1, parm1);" , dbopenSnapshot, dbSqlPassthrough ); msgbox rs(0) ' ---- Contains the SPL's first return value msgbox rs(1) ' --- Contains NULL, even though the SPL returns a value. '--------------------------------------------------------------------------- ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com