title: Loop DataColumns in DataRow
body: <p>I am converting data table content to string, Say the dataset has 12 rows and 8 column.
  At the end, the Dict contain 12 rows or 96 columns. what's wrong with my code below, how do I reset the row?</p>
  
  <p>Tia.</p>
  
  <pre><code>        Dim ds As DataSet = ClsDB.GetDataSet(sql)
  
      If Not ds Is Nothing AndAlso ds.Tables.Count &gt; 0 Then
          Dim row As New List(Of KeyValuePair(Of String, String))
          Dim dict As New List(Of KeyValuePair(Of Integer, Object))
          Dim dt As DataTable = ds.Tables(0)
          Dim i As Integer = 0 
  
          For Each dr As DataRow In dt.Rows 
              For Each dc As DataColumn In dt.Columns
                  row.Add(New KeyValuePair(Of String, String)(dc.ColumnName, IIf(Not IsDBNull(dr.Item(dc.ColumnName)), dr.Item(dc.ColumnName), "")))
              Next
              dict.Add(New KeyValuePair(Of Integer, Object)(i, row))
              i += i 
          Next
  
          Return New JavaScriptSerializer().Serialize(dict)
      Else
          Return "No Data"
      End If
  </code></pre>