S
Shapper
Hello,
I am trying to create a dataset by adding rows to it in a For loop:
Dim dsNews As DataSet = New DataSet()
Dim row As DataRow = dsNews.Tables(0).NewRow()
dsNews.Tables.Add
dsNews.Tables(0).Columns.Add("title", GetType(String))
dsNews.Tables(0).Columns.Add("description", GetType(String))
For x = 1 To 10
With row
.Item("title") = "Some Title"
.Item("description") = "Some Description"
End With
dsNews.Tables(0).Add(row)
Next x
I get the error:
'Add' is not a member of 'System.Data.DataTable'.
What am I doing wrong?
Thanks,
Miguel
I am trying to create a dataset by adding rows to it in a For loop:
Dim dsNews As DataSet = New DataSet()
Dim row As DataRow = dsNews.Tables(0).NewRow()
dsNews.Tables.Add
dsNews.Tables(0).Columns.Add("title", GetType(String))
dsNews.Tables(0).Columns.Add("description", GetType(String))
For x = 1 To 10
With row
.Item("title") = "Some Title"
.Item("description") = "Some Description"
End With
dsNews.Tables(0).Add(row)
Next x
I get the error:
'Add' is not a member of 'System.Data.DataTable'.
What am I doing wrong?
Thanks,
Miguel