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!

Return an array from Data Reader?

Status
Not open for further replies.

Ecreations

Programmer
Jul 6, 2002
220
CA
Hi Guys,
Is there any ways a Data Reader returns an array?
I managed to to get all values returned from the Data Reader into a an arraylist.
here is the code
Do while ObjReader.Read()
For IntCounter = 1 to ObjReader.Fieldcount - 1
MyArray.add(CSTR(ObjReader.GetValue(IntCounter))
Next Intcounter
loop


 
ArrayList contains a .ToArray() method that would work nicely for this.

-paul

penny.gif
penny.gif

The answer to getting answered -- faq855-2992
 
hey thanks Paul
i figured that out the hard way.
heres the code i used
Dim NewsArray as New ArrayList
Dim Obj as Object
Dim i As Int32 = 0

Dim StrArray(NewsArray.Count) As String
For Each obj In NewsArray
StrArray(i) = obj.ToString
i += 1
Next obj
the StrArray will contain all the Object data as a string array



The solution is simple, the problem is complex.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top