Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > ASP Forms
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 2nd, 2005, 12:17 PM
jamara
Guest
 
Posts: n/a
Default returning multiple values from called funct

Hi,
   I am new to .asp pages and have a basic question. I am trying to code a function which returns multiple values. Here is the scenerio:
The userid and department will be sent to a function. The function will query this info and return 5 fields. These fields are used by the calling form to route processing within the application.

Code example from calling form:
 If strUIDType = "Common" Then
      processCBUnits strUsername, strDepartment
 End if

Function code:
Function processCBUnits(strUsername, strDepartment, byRef strFormNo1, byRef strFormNo2, byRef strFromNo3)

The function then queries the database for appropriate values.

I'd like to send strFormNo1, strFormNo2, and strFormNo3 back to the calling form.

Thanks!


 
Old March 2nd, 2005, 04:33 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

I beleive a function can only return one value. You could return an array and pull the values out. Or you can create a string, and separate each value with a comma, then pull the values out of that.

Also, since you function queries the Db, you can return a recordset which would probably be the best choice.
 
Old March 2nd, 2005, 07:45 PM
Authorized User
 
Join Date: Feb 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well as already advised, array is a good choice. I guess you can also get the function to Return an XML stream and then you can read the stream and pull the values out.

Regards

 
Old March 3rd, 2005, 12:26 PM
jamara
Guest
 
Posts: n/a
Default

Thanks for your advise/feedback. I will give that a try. Question: would either of you recommend passing variables back using the 'by ref' keywords?

Thanks in advance for answering...






Similar Threads
Thread Thread Starter Forum Replies Last Post
Date on report called from multiple forms mean34dean Access 7 April 23rd, 2008 09:24 AM
Returning Null Values in a query dstein4d Access VBA 2 March 21st, 2008 03:59 PM
Button Handler Being called multiple times ExDb VB Databases Basics 1 January 22nd, 2006 07:32 PM
Methods - Returning Multiple Values? p_nut33 VB.NET 2002/2003 Basics 5 December 22nd, 2003 10:09 AM
returning values with SQL stu9820 SQL Language 6 December 8th, 2003 02:36 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.