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

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.
 
S

sloan

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.
 
J

JustinBlat

I think in C# you should be able to say:
datatable.rows[j]
and that should return the proper object
 
R

rajkushi

Hi Carol,

In C# you need say like this;

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

Thanks,
Thiagarajan Rajendran.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top