Column and dataset

  • Thread starter Thread starter Gabriel
  • Start date Start date
G

Gabriel

Hello

I have this :

foreach (DataRow row in dataset.Tables[0].Rows)

{

....... //

}



In the loop how can I retrieve a specific column value but from the column
name and from the index ?



Regards,
 
Each item in the DataColumns collection has a ColumnName property. You can
get these before you start the foreach.

It's not possible to do something like this (int the loop) :
row[0]["ColumnName"]

??

Thanks,
 
Gabriel,

It is the Item property which is the default.

Therefore in C# you use it as you wrote, you can reference it with
an integer (the slowest) a string and the DataColumn as that is a property
from the Columncollection from the dataset. The latter is the fastest.

Cor
 

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

Back
Top