Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Best way to pass data (rst obj or array)

Status
Not open for further replies.

123ASP

MIS
Nov 2, 2002
239
US
hi, I want to access a table and pull some fields,then I want to pass the data to another function to do some process. what is best, to pass the rst object as an input parameter to the function or put the rst obj into an array then pass the array to the function, ( I am not sure if I can do the last one though)
thanks
Al
 
It depends on how you use it.

If you're pulling the same number of fields each and every time, you can loop through the records passing each of the fields from a single row as arguments to a function. Beacuse each result is going to have the same number of fields, you don't have to worry about blanks or lost data.

BUT, if this funciton is being called by different areas of your script that may not necessarily select the same number of columns all the time, you should add each of the fields to an array so you can pass one single item - the array - into the function. Then, one area of the script can pass in an array with 10 items, while another area of the script can pass an array of 20 items, and the function isn't going to complain about the number arguments. There's only one!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top