In VB, you would use an array for this:
Dim str(oRecordSet.Fields.Count)
Then store your values in array elements. If you want to address them by name, use a collection object
to store them, but arrays are the fastest component in VB..
>Is it possible to work with pointers (a la macro substitution in VFP) in VBScript? I'm trying to create some generic scripts to handle data processing and need this ability. As an example:
>
>I want to loop through the Fields collection of a recordset. For each item in the Fields collection, I want to programmatically create a variable by prepending "str" to Fields.Name. Then I want to assign that variable the Fields.Value property. In VFP, it would look like:
>
>oConnection = CreateObject("adodb.connection")
>oConnection.Open("Source")
>
>oRecordSet = CreateObject("adodb.recordset")
>oRecordSet.Open("Select * From Plan!Inhouse Order By Latiname", oConnection)
>
>For Each Item In oRecordSet.Fields
> strTemp = "str" + Item.Name
> * Substitute the value of strTemp and assign the fields value
> &strTemp = Item.Value
>EndFor
>
>At this point, I would have a set of variables available to me with the proper value assigned. Any help or ideas are as always appreciated.
>
>TIA, Bill
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement