473,326 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Looping through datarow

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
Nov 18 '05 #1
2 1431
Dim cnt As Integer

cnt = drIn.Table.Columns.Count

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

HTH

"AMD Desktop" <ma******@yahoo.com> wrote in message
news:CM********************@magma.ca...
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

Nov 18 '05 #2
Thanks a lot
"Shiva" <sh******@online.excite.com> wrote in message
news:OY*************@TK2MSFTNGP11.phx.gbl...
Dim cnt As Integer

cnt = drIn.Table.Columns.Count

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

HTH

"AMD Desktop" <ma******@yahoo.com> wrote in message
news:CM********************@magma.ca...
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

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Cappy | last post by:
I am writing an XML menu structure. I have the following XML file <MenuItems> <Item> <Name>Homepa5ge</Name> <URL>/index.aspx</URL> <Alt>Return to homepage</Alt>...
3
by: Ryan Ternier | last post by:
I gota scoot here so I gota make it quick :) I'm doing a conversion from 2 different databases (2 different software versions) I have each table stored in a Datatable, and I'm going to append...
4
by: Ryan Ternier | last post by:
I'm having an issue with an inner loop. Here's the basic Code: For each......{ //Do code here //start other loop For each....{
1
by: Kelvin | last post by:
Hi All, How to get column value from datarow while datatable looping ? Please advised !
4
by: Kelvin | last post by:
Dear All, Please help. Same as subject !!!
1
by: Kelvin | last post by:
Hi All, I wrote a program insert new row between rows while the datatable is looping. It display the error message. Exception Details: System.ArgumentException: This row already belongs to this...
0
by: Kelvin | last post by:
Hi All, While the existing datatable is looping, I can insert new row into datatable, but I can't insert it between datarows. All new rows will inserted into buttom row. Here is my code. Please...
5
by: Stimp | last post by:
This is a question I'm carrying over from a previous one I made today since I've simplified where the problem is... I have a datatable, tblFeatures, which has around 30 columns (one for each...
2
by: randy1200 | last post by:
My hope is that somebody has a thought on this, or can point to toward an article that's useful. I have the following: DataSet ds = new DataSet(); ds.ReadXml("MyData.xml"); Each MainTable...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.