DataTable has a propierty called Rows.
Imagine you got this:
oTable as your table already filled with the data. So you do this:
oTable.Rows(0)(0) this will give you the value of the Row 1 Colum 1
oTable.Rows(1)(0) this will give you the value of the Row 2 Colum 1
oTable.Rows(1)(2) this will give you the value of the Row 2 Colum 2
and so On...
It's like a two-dimension array the 1st array gives you the Rows and the 2nd
one the Colums
Hope this help.-
On 10/2/07, spooboy54 < spooboy54%40yahoo.com">spooboy54
yahoo.com> wrote:
> Guys
>
> A buddy of mine is working with .Net (poor guy --
> hehe, sorry, I'm a VB6 kinda guy). He has populated
> a datatable.. it was initialized with the following...
>
> Dim MyDT as New DataTable
>
> It is then populated using...
>
> Dim dataadapter As New SqlDataAdapter(testCommmand)
> dataadapter.Fill(MyDT)
>
> I've left out the connection code.. assume that MyDT
> is populated. Here is the question:
>
> How would he read the value of record 1, field 1,
> and stick it in a variable v1. Then, how would
> he advance to record 2, field 1, and do same?
>
> Using Access and VB6, I'd do something like this:
>
> Dim MyRS as Recordset
> <code to populate the table>
> MyRS.MoveFirst
> v1 = MyRS("MyField")
> MyRS.MoveNext
> v1 = MyRS("MyField")
>
> Pretty easy with Access and VB6.
> How does one do that in .Net?
>
> Spoo
>
>
>
[Non-text portions of this message have been removed]
.