title: vb.net - Formatting a datetime column of a datatable to a yyyy/MM/dd HH:mm string
body: <p>I dont seem to be able to figure out what is wront in the code. Here is a screenshot to see the error message, the code, and the content of the variable.</p>
  <p>and a bigger part of the code:</p>
  <pre><code>       For Each value As DataColumn In dt2.Columns
                      If value.DataType = System.Type.GetType(&quot;System.DateTime&quot;) Then
                          dq = dq &amp; value.ColumnName &amp; &quot; = '&quot; &amp; r2.Item(value.ColumnName).ToString(&quot;yyyy/MM/dd HH:mm:ss&quot;) &amp; &quot;' and &quot;
                      End If
  
              Next
  </code></pre>
  <p><a href="https://i.stack.imgur.com/SFQH1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SFQH1.png" alt="enter image description here" /></a></p>
  <p>what am I doing wrong?</p>