Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > loop recordset adding fields to data dictionary

Reply
Thread Tools

loop recordset adding fields to data dictionary

 
 
JT
Guest
Posts: n/a
 
      04-20-2004
how can i loop through all the fields in a recordset adding a collection of
name/value pairs to a data dictionary where name is the field name and value
is the field value. this is what i have so far (not working, of course..)
this is will only be used for one row recordsets.

dim d
set d = CreateObject("Scripting.Dictionary")

for each field in rsGetData.Fields
d.Add LCase(field), rsGetData.Fields(field)
Next

tia
jt


 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      04-20-2004
JT wrote:
> how can i loop through all the fields in a recordset adding a
> collection of name/value pairs to a data dictionary where name is the
> field name and value is the field value. this is what i have so far
> (not working, of course..)


Please define "not working". Error message? Wrong result?

> this is will only be used for one row recordsets.
>
> dim d
> set d = CreateObject("Scripting.Dictionary")
>
> for each field in rsGetData.Fields
> d.Add LCase(field), rsGetData.Fields(field)
> Next
>


This is what I would do:

'disconnect the recordset and close the connection:
set rsGetData.ActiveConnection=nothing
conn.close:set conn = nothing

'now write the dictionary items:
for each fld in rsGetData.Fields
d.Add LCase(fld.name), fld.value
next

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
 
 
 
roger
Guest
Posts: n/a
 
      04-21-2004
"JT" wrote
> for each field in rsGetData.Fields
> d.Add LCase(field), rsGetData.Fields(field)
> Next


Does this work?

for each field in rsGetData.Fields
d.Add LCase(field.name), field.value
Next

--
roger


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Triple nested loop python (While loop insde of for loop inside ofwhile loop) Isaac Won Python 9 03-04-2013 10:08 AM
Asp to Aspx, Response.Write Recordset.fields(1).value question Gian Paolo Clarici ASP .Net 0 07-21-2004 12:14 PM
Loop Through a recordset Steven K ASP .Net 1 03-04-2004 01:04 AM
Problem accessing individual recordset fields in a Sql Server 7 view via ASP Darren Smith ASP General 2 01-28-2004 08:29 PM
RecordSet.Move or RecordSet.AbsolutePosition?? Hung Huynh ASP General 8 09-24-2003 11:07 AM



Advertisments