'System.Data.DataRowCollection' does not contain a definition for 'Item'

  • Thread starter Thread starter Carlos
  • Start date Start date
C

Carlos

Hi all,

I have 2 asp .net 2.0 projects currently being developed. One is in
VB .Net and the other in C#. In the VB .Net project I can cross-reference
a datatable object using the datatable.rows.item(i).item(j) , but in the
C# project I can not do it. That is, I do get:

error 'System.Data.DataRowCollection' does not contain a definition for
'Item'
They are running under the same development evironment. (i.e. Asp .Net 2.0)


Does anyone know what can be happening?

Thanks,

Carlos.
 
The "indexer" in VB.net is called by .Item(someInt)

ex:

myCollection.Item(someInt)

in C#, the indexer is called like this

myCollection[someInt]; // no use of the work "Item" here.
 
I think in C# you should be able to say:
datatable.rows[j]
and that should return the proper object
 
Hi Carol,

In C# you need say like this;

DataRowCollection oDataRow = new DataRowCollection();
oDataRow[j];

Thanks,
Thiagarajan Rajendran.
 
Back
Top