How do I take an array of objects and load it into a dataset datatable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • OriginalTwist

    How do I take an array of objects and load it into a dataset datatable

    I have an array of records pulled from a dateset linq query thgen parsed to contatecate first names and last names.
    The new array looks like:

    person(int1,0) <--- this holds person ID
    person(int1,1) <--- this holds person name

    I have the following code to create the new data table

    Code:
    dim data As New Dataset
    data.Tables.Add("people")
    data.Tables("people").Columns.Add("id")
    data.Tables("people").Columns.Add("name")

    I am trying to use:

    Code:
    data.Tables("people").BeginLoadData()
    data.Tables("people").LoadDataRow(parsed(int1, 1), True)
    data.Tables("people").EndLoadData()
    I think i am probably kinda close, but still far from the solution. The above doesn't work

    Thanks
  • David Gluth
    New Member
    • Oct 2010
    • 46

    #2
    Hi Original.

    I don’t have a lot of experience with LINQ, but should your “parsed” verb be attached to the array?

    data.Tables("pe ople").LoadData Row(parsed(int1 , 1), True) S/B
    data.Tables("pe ople").LoadData Row(person.pars ed(int1, 1), True)

    Dave

    Comment

    Working...