Looping through datarow

A

AMD Desktop

Hi,

I am passing a datarow to a function and need to iterate through this
datarow and parse it. The number of columns is unknown so I need to do
something like this:

Public Sub ConvertByTabsDataRow(ByVal drIn As DataRow)

For i = 0 To drIn.ItemArray.Count
If drIn.IsNull Then
strLine = strLine & "N/A" & Chr(9)
Else
strLine = strLine & drIn.ItemArray(i).toString() & Chr(9)
End If
Next

End Sub

Count is not a member of ItemArray so I can not use it, how do I iterate
through this datarow?

Thank you
 
S

Shiva

Dim cnt As Integer

cnt = drIn.Table.Columns.Count

For i = 0 To cnt-1
If (drIn(i).IsNull Then
....
....
Next

HTH

Hi,

I am passing a datarow to a function and need to iterate through this
datarow and parse it. The number of columns is unknown so I need to do
something like this:

Public Sub ConvertByTabsDataRow(ByVal drIn As DataRow)

For i = 0 To drIn.ItemArray.Count
If drIn.IsNull Then
strLine = strLine & "N/A" & Chr(9)
Else
strLine = strLine & drIn.ItemArray(i).toString() & Chr(9)
End If
Next

End Sub

Count is not a member of ItemArray so I can not use it, how do I iterate
through this datarow?

Thank you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top