Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Retrieving a field value from a Dataset
Message
From
24/07/2002 19:37:14
Jorge Haro
Independent Consultant
Juarez, Mexico
 
 
To
All
General information
Forum:
ASP.NET
Category:
ADO.NET
Title:
Retrieving a field value from a Dataset
Miscellaneous
Thread ID:
00682350
Message ID:
00682350
Views:
59
This is probably terribly simple but I can't seem to find it anywhere in the docs. How do I retrieve a field value from a dataset, the examples use something like:
foreach(DataTable tabla in dsCustomers.Tables)
   foreach(DataRow rowCustomer in tabla.Rows )
   {
      Console.WriteLine(rowCustomer["cCustName"]);
   }
What if I want to just retrieve the value of a field from the current row?
I've tried
   MyDataSet.Tables["CUSTOMERS"].Columns["cCustName"]
But that gives me the name of the column, I suppose it's like calling ToString for the Column object. So I looked for a Column property similar to ADO's Value property, and I couldn't find one listed in DataColumn members, strange that you can get all sorts of info about the column except for the actual value.

I've also tried using the Rows object but couldn't figure out the correct syntax, any help would be appreciated.

In classic ADO all I had to do was:
   MyRecordSet.Fields("cCustName").Value
Next
Reply
Map
View

Click here to load this message in the networking platform