Posted By

miziomon on 01/12/07


Tagged

datatable


Versions (?)


Advertising

Submit Site


Who likes this?

1 person has marked this snippet as a favorite

haoji


Create DataTable


Published in: VB.NET 



Website Promotion
DIRECTORY
is a crucial factor for all websites that need to gain better organic search engine rankings and increase website traffic.
Submitting your website as part of your Web Promotion strategy to our SEO friendly and high traffic Business Directory for review is an excellent way to gain a valuable backlink and increase your websites visibility online.

Submit Site


Howto create a new datatable manually

Expand | Embed | Plain Text
  1. Public Function CreateDatatable() as DataTable
  2. ' Create new datatable
  3. Dim mydatatable As New DataTable
  4. ' Create columns
  5. mydatatable.Columns.Add("field_a", Type.GetType("System.String"))
  6. mydatatable.Columns.Add("field_b", Type.GetType("System.String"))
  7. ' Declare row
  8. Dim myrow As DataRow
  9. ' create new row
  10. myrow = mydatatable.NewRow
  11. myrow("field_a") = "filed a row 1"
  12. myrow("field_b") = "filed b row 1"
  13. mydatatable.Rows.Add(myrow)
  14. ' create another row
  15. myrow = mydatatable.NewRow
  16. myrow("field_a") = "filed a row 2"
  17. myrow("field_b") = "filed b row 3"
  18. mydatatable.Rows.Add(myrow)
  19. ' return the datatable filled with 2 columns and rows
  20. return mydatatable
  21. End Sub

Report this snippet 

You need to login to post a comment.

Download royalty free graphics