Click to See Complete Forum and Search --> : Little confusion!


Reehan Ishaque
April 17th, 2003, 12:21 PM
check this statement

objTable.Rows(0).Item("name")

this statement extract value of name column from the given DataTable object reference. Here Rows is DataTable propery which returns DataRowCollection but Item is a property of DataRow class so is it possible to return DataRow object refenrence from Rows property and use Item property.

what i think it is doing is, it is using Item property of DataRowCollection class to get the required row and then using Item property of that returned row to get the value of column name. but again if it is so how is it happening be hind the scene.

plz make me clear this concept

DSJ
April 17th, 2003, 01:36 PM
objTable.Rows(0).Item("name") is the same as

Row = objTable.Rows(0)
Item = row.Item("name")

coolbiz
April 18th, 2003, 02:47 PM
Well, the ITEM in DATAROWCOLLECTION is type of DATAROW. So when you .ROWS(0), you're retrieving the DATAROW item from the DATAROWCOLLECTION.

-Cool Bizs