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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query row random access

Status
Not open for further replies.

krisplus5

Programmer
Joined
Oct 4, 2001
Messages
44
Location
US
Is there a way to retrieve data from a specific row or a query recordset--rather than looping through the recordset. Something like queryname.getdata(17,3) where the 17,3 represent row and column numbers. I haven't been able to find anything in the documentation or myriad books we have.

Thanks,
Kris
 
Yes, you can reference the query as if it were an array of structures. Structures being the column names and arrays being the rows.

Table Named: User

userID | userName
----------------------
42 | jane
56 | joey
99 | matt
104 | cindy

<CFQUERY NAME=&quot;qUsers&quot;>
SELECT * FROM User
ORDER BY userID
</CFQUERY>

<CFOUTPUT>
#qUsers.userName
Code:
[
2
Code:
]
#[COLOR=000080]<BR>[/color] [COLOR=666666]<!--- joey --->[/color]
#qUsers.userName
Code:
[
1
Code:
]
#[COLOR=000080]<BR>[/color] [COLOR=666666]<!--- jane --->[/color]
#qUsers.userName
Code:
[
4
Code:
]
#[COLOR=000080]<BR>[/color] [COLOR=666666]<!--- cindy --->[/color]
#qUsers.userName
Code:
[
3
Code:
]
#[COLOR=000080]<BR>[/color] [COLOR=666666]<!--- matt --->[/color]
</CFOUTPUT> - tleish
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top