Home All Groups Group Topic Archive Search About
Author
10 Jan 2006 8:25 PM
rodchar
hey all,

what's the best way to get records in a dataset into an array?

Thanks,
rodchar

Author
10 Jan 2006 9:22 PM
Chris
rodchar wrote:
> hey all,
>
> what's the best way to get records in a dataset into an array?
>
> Thanks,
> rodchar

Isn't it already?

If you take the datatable that is inside the dataset, it is just an
array or datarows.

DataTable.Rows(Y)(X)

Chris
Author
11 Jan 2006 2:36 AM
Ron Dahl
Rod, I use a loop structure similar to:
For i = 0 To myDataSet.Tables(0).Rows.Count

  For j = 0 To myDataSet.Tables(0).Columns.Count

    If IsDBNull(myDataSet.Tables(0).Rows(i)(j)) = False Then

      myarray(i, j) = myDataSet.Tables(0).Rows(i)(j)

    End If

  Next j

Next i

Ron Dahl
Author
11 Jan 2006 6:27 AM
Cor Ligthert [MVP]
Rodchar,

A dataset cannot hold anything except datatables. Can you be a little bit
more clear?

Cor
Author
11 Jan 2006 10:08 AM
Armin Zingler
"rodchar" <rodc***@discussions.microsoft.com> schrieb
> hey all,
>
> what's the best way to get records in a dataset into an array?


Dunno if this helps:

Dim a As DataRow()

ReDim a(dt.Rows.Count - 1)

DirectCast(dt.Rows, ICollection).CopyTo(a, 0)



Armin