Looping through datarow

  • Thread starter Thread starter AMD Desktop
  • Start date Start date
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
 
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
 
Back
Top