Dan Flood
asked on
a FOR EACH ... NEXT loop problem with each field in a selected record
I can't seem to figure out to select each item in a selected record. The Record (Formula) has about 200 fields in it. I would like to so a:
FOR EACH field in the selected database record
console.writeline( that fields value )
NEXT
Formula is dim'ed as DataSet.tblFormulas.FindBy CODE("2331 ")
Maybe it's late and I'm foggy, but I can't figure out how to do this....
Thanks
FOR EACH field in the selected database record
console.writeline( that fields value )
NEXT
Formula is dim'ed as DataSet.tblFormulas.FindBy
Maybe it's late and I'm foggy, but I can't figure out how to do this....
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi,
yes the .FindByCODE("xxxxxx") is an automatically generated routine that returns a datarow. VB creates the .FindBy<that_tables_key(so mething)
This was exactly the guidance I was looking for. Thanks!
yes the .FindByCODE("xxxxxx") is an automatically generated routine that returns a datarow. VB creates the .FindBy<that_tables_key(so
This was exactly the guidance I was looking for. Thanks!
ASKER
argh
It is telling me that my row isn't a collection type (formula is a datarow of table tblFormulas
For Each item As DataColumn In Formula ' (formula is underlined with this error: Expression is of type 'dtfDataSet.tblFormulasRow ', which is not a collection type. )
Console.WriteLine(item.Col umnName & " = " & item.ToString)
Next
It is telling me that my row isn't a collection type (formula is a datarow of table tblFormulas
For Each item As DataColumn In Formula ' (formula is underlined with this error: Expression is of type 'dtfDataSet.tblFormulasRow
Console.WriteLine(item.Col
Next
That's because your code, unlike either Wayne's or mine, is treating Formula _itself_ as the collection. If you look at Wayne's code it used For Each on Formula.Table.Columns, and Columns is a Collection. If you look at mine it used For Each on dr.ItemArray, and ItemArray is a Collection.
Roger
Roger
ASKER