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

Entire record to string, not individual fields 1

Status
Not open for further replies.

javanic

Programmer
Jun 18, 2003
13
US
Hi.

Is there a way to send an entire record to a string without having to reference each field in the record? I would like to loop through a recordset, sending each record to a string for display. I don't need to update the recordset ever, so I don't really want to mess with it.

Hope this makes sense. I'm still reading the A2KDH book, so I don't have the answer myself. :)

Thanks,


- javanic -
 
javanic,
You may not know, but you can refer to recordset fields by their ordinal position in the recordset(zero significant), instead of by name, (that's what ADO actually does--just uses the field name to look up the ordinal position), so in order to assemble them all in a string, just do like so:

Dim myStr as String
Dim intCtr as Integer

myStr = ""

For intCtr = 0 to <column_count - 1>
myStr = myStr + rst.Fields(intCtr)
Next intCtr

Good Luck,
Tranman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top