I have a table with a few colums and the test data is 500 rows in which I am trying to create a string of 'a' records in a string builder, which is working fine but the number of 'a' records are duplicated more than twice, which doesn't make sense. If I
check the number of rows it reads correctly so I am unsure how come these items are duplicated.
I am just using the usual code anyone would use:
Dim sb As StringBuilder = New StringBuilder
Dim strTemp As String = String.Empty
For i As Integer = 0 To ds.Tables(strTable).Rows.Count
strTemp += "My Code Here To Create The 'a' tag" ' URL (href), Link Text (title), Link Text (clickable text) strTemp += ds.Tables(strTable).Rows(i).Item(2) bla bla ds.Tables(strTable).Rows(i).Item(1) bla bla ds.Tables(strTable).Rows(i).Item(1)
sb.Append(strTemp)
Next
Database Table Colums:
1) An Integer
2) Link Text
3) URL
4) Not Important
The StringBuilder outputs the finished string like so: Link 1, Link 1, Link 2, Link 2... Link 1, Link 1, Link 2, Link 2 rather than Link 1, Link 2, Link 3 and so on. That's what doesn't make sense. Why is it duplicating?
Have searched Google so not interested in links. This is a VB.NET forum so not interested in C#, C++, F# and so on.
Member
104 Points
319 Posts
Iterate Through Dataset
Jun 04, 2014 06:05 PM|crouchie2004|LINK
Hi,
I have a table with a few colums and the test data is 500 rows in which I am trying to create a string of 'a' records in a string builder, which is working fine but the number of 'a' records are duplicated more than twice, which doesn't make sense. If I check the number of rows it reads correctly so I am unsure how come these items are duplicated.
I am just using the usual code anyone would use:
Database Table Colums:
1) An Integer
2) Link Text
3) URL
4) Not Important
The StringBuilder outputs the finished string like so: Link 1, Link 1, Link 2, Link 2... Link 1, Link 1, Link 2, Link 2 rather than Link 1, Link 2, Link 3 and so on. That's what doesn't make sense. Why is it duplicating?
Have searched Google so not interested in links. This is a VB.NET forum so not interested in C#, C++, F# and so on.
Any ideas?
iterate dataset vb.net
All-Star
37441 Points
9076 Posts
Re: Iterate Through Dataset
Jun 04, 2014 06:15 PM|AidyF|LINK
Change
to
iterate dataset vb.net
Member
104 Points
319 Posts
Re: Iterate Through Dataset
Jun 04, 2014 06:18 PM|crouchie2004|LINK
I am so shattered I never saw that I still had that in there from something earlier - cheers
iterate dataset vb.net