Oh good grief. Well thanks for your answer, but I can do without the
moral correction, especially since I'm not hiding incompetence. I'm
throwing my FRUSTRATION and CONFUSION right out there for all to see.
And I didn't say any "bad words". Hope you didn't melt or turn into a
pumpkin or something after reading such atrocious language, er,
symbols.
For your information, my confusion was in the fact that my code almost
exactly matches the code Microsoft uses in the help file for the
GetChildRows method (see excerpt below):
Dim instance As DataRow
Dim relation As DataRelation
Dim returnValue As DataRow()
returnValue = instance.GetChildRows(relation)
They don't show that GetChildRows requires an index after the call. I
found that though by searching more closely in the example they give
farther down the page. So thanks for helping me, and also making me a
holier person.
On Nov 2, 11:33 am, Theo Verweij <tverw...@xs4all.nlwrote:
I, and I think a lot of other posters in this form, would like it if you
wouldn't hide your own incompetence with bad words.
Your problem is quite simple; you are assigning an array of rows
(parentRow.GetChildRows("DataRelation")) to a row.
And that's not possible.
Daniel wrote:
What's wrong with this code?
1 Dim parentRow, childRow as DataRow
2
3 For i = 0 To mainDataTable.Rows.Count - 1
4 parentRow = mainDataTable.Rows(i)
5 childRow = parentRow.GetChildRows("DataRelation")
6 mainDataTable.Rows(i).Item("Column1") = childRow.Item("Column1")
7 next i
mainDataTable is a plain old DataTable already instantiated.
DataRelation is the name of a valid DataRelation object in the DataSet
that joins these two tables.
I get this error at line 5:
"Value of type '1-dimensional array of System.Data.DataRow' cannot be
converted to 'System.Data.DataRow'.
What conversion is it talking about? I'm loading a DataRow object with
a DataRow object!!!
Any help is greatly appreciated,
Daniel