Creating and manipulating a dataTable

Category : ASP.Net, VB.Net

This structure keeps coming up :

 dsSchools = mydata
 
'Create table to bind to dataGrid
Dim dt As New DataTable
Dim nameCol, activeCol As New DataColumn
dt.Columns.Add(nameCol)
dt.Columns.Add(activeCol)
Dim dRow As DataRow = dt.NewRow
 
For Each dr As DataRow In dsSchools.Tables(0).Rows
       If Not dr("title") Is DBNull.Value Then dRow(nameCol) = dr("title")
       If Not dr("IsActive") Is DBNull.Value Then dRow(activeCol) = dr("isActive").ToString
       dt.Rows.Add(dRow)
Next

Post a comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word