For creating datatable and inserting values to the datatable from code.

Jobin
Posted by Jobin under VB.NET category on | Points: 40 | Views : 1171
Dim myDataTable As New DataTable
Dim dataColumn As New DataColumn("FirstName", GetType(String))
Dim dataColumn1 As New DataColumn("LastName", GetType(String))
Dim dataColumn2 As New DataColumn("MiddleName", GetType(String))
Dim row As DataRow = Nothing
myDataTable.Columns.Add(dataColumn)
myDataTable.Columns.Add(dataColumn1)
myDataTable.Columns.Add(dataColumn2)
row = myDataTable.NewRow()
row("FirstName") = "Rahul"
row("LastName") = "Nair"
row("MiddleName") = "K"
myDataTable.Rows.Add(row)

Comments or Responses

Login to post response