title: How to move to next row in dataset and display in hyperlink
body: <p>I'm writing an email application that will be used to send HTML news articles to clients.
  I'm using a dataset to return the headlines to display to the client.  When I loop through the dataset the the latest record is returned but latest headline link is not displayed. So the outputted HTML is the same headline everytime, which is the first record in the dataset.  How do I move to the next record in the data set and get the outputted HTML to display the next/correct headline?</p>
  
  <p>Here is a sample of my code: </p>
  
  <p><strong>'Code to populate dataset</strong></p>
  
  <p>Public Function GetHeadline(ByVal ArticleID As Integer) As DataSet</p>
  
  <pre><code>    Try
          Dim objConn As SqlConnection = New SqlConnection()
          objConn.ConnectionString = myConnectionString
          objConn.Open()
  
          ds = New DataSet
          ds.Clear()
  
          Dim sqlCommand As String = "SomeSql"
  
          Dim objCmd As SqlCommand = New SqlCommand(sqlCommand, objConn)
  
          Dim dataAdapter As SqlDataAdapter = New SqlDataAdapter(objCmd)
          dataAdapter.Fill(ds)      
  
          Catch ex As Exception
          MsgBox(ex.ToString)
          GetHeadline = Nothing
      End Try
  
      Return ds
  
  End Function
  </code></pre>
  
  <p><strong>'Code to populate link</strong></p>
  
  <pre><code>If GroupID = 4 Then
  iLocation1 = HTMLbody.IndexOf("{!HeadlineID")
  
  While iLocation1 &gt; 0
   iLocation2 = HTMLbody.IndexOf("}", iLocation1)
   sHeadLineTag = HTMLbody.Substring(iLocation1 + 1, iLocation2 - iLocation1 - 1) 
   dtReport = clsGlobal.globalReportCatalog.GetHeadline2() 
   clsGlobal.globalReportCatalog.SetHeadlinePropertiesFromRow(dtReport.Rows(0))
  
   With clsGlobal.globalReportCatalog
    For i As Integer = 0 To dtReport.Rows.Count
     If i &lt; dtReport.Rows.Count - 1 Then
      i = i + 1
     End If
  
     Dim ID As Integer = dtReport.Rows(i)("ArticleID")
  
     sHyperTag = "&lt;a href=""" &amp; "http://www.myweb.com/somedirectory/Login.aspx" &amp; .HeadlineMarketingLink &amp; """&gt;" &amp; .HeadlineReportName &amp; " - " &amp; .HeadlineTitle &amp; "&lt;/a&gt;"
     sHeadlineDescription = .HeadlineDescription   
  
     HTMLbody = HTMLbody.Replace("{!Report.Description}", sHeadlineDescription)
  
    Next
   End With
  </code></pre>