Make and edit DataTable in code


/ Published in: VB.NET
Save to your folder(s)

Como crear un DataTable a mano y editar sus columnas y filas bajo código.


Copy this code and paste it in your HTML
  1. Private Sub InitDataset()
  2. Dim lDataTable As New DataTable
  3. Dim lDataColum As DataColumn
  4. Dim lDataRow As DataRow
  5.  
  6. lDataColum = New DataColumn
  7. lDataColum.DataType = System.Type.GetType("System.String")
  8. lDataColum.ColumnName = "FileName"
  9. lDataTable.Columns.Add(lDataColum)
  10.  
  11. lDataColum = New DataColumn
  12. lDataColum.DataType = System.Type.GetType("System.String")
  13. lDataColum.ColumnName = "Extension"
  14. lDataTable.Columns.Add(lDataColum)
  15.  
  16. lDataColum = New DataColumn
  17. lDataColum.DataType = System.Type.GetType("System.String")
  18. lDataColum.ColumnName = "Lenght"
  19. lDataTable.Columns.Add(lDataColum)
  20.  
  21. lDataColum = New DataColumn
  22. lDataColum.DataType = System.Type.GetType("System.Date")
  23. lDataColum.ColumnName = "Date"
  24. lDataTable.Columns.Add(lDataColum)
  25.  
  26. mDts = New DataSet
  27. mDts.Tables.Add(lDataTable)
  28. End Sub

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.