A column in a datatable is like a column in a table in your database. You
wouldn't expect the column definition to just have a value, would you? No.
You would expect a column (cell) in a particular row to have a value. Same
goes here.
Asking a column to have a value doesn't make sense semantically.
Something like:
DataTable1.Rows(0)("guest_no")
makes sense. That asks for the value of the guest_no column in the first
row.
Remember that this returns an Object, turn Option Strict On, and then type
this to the correct type - in your case a string.
"MattB" <so********@yahoo.com> wrote in message
news:3t************@individual.net...
I know I can use dataviews and more looping to do this, but I'm wondering
if there's a more elegant or more concise way to do this.
I've got two DataTables with a column called guest_no. I'd love to be able
to use something like the .IndexOf method of arrays and bound controls.
Somehting like:
Dim r as DataRow
For Each r in DataTable2.Rows
If DataTable1.Columns("guest_no").IndexOf(r("guest_no ")) <> -1
'record exists
'do something
Else
'record doesn't exist
'do something else
End If
End For
Is there anything like this? Obviously, the code above doesn't work.
Thanks,
Matt