Reading single field values from a dataset

  • Thread starter Bjorn Sagbakken
  • Start date
B

Bjorn Sagbakken

What is the best way to read single field values from a dataset? The dataset
is populated with a customer record, showing well in a gridview. But I also
want to read the single field values, like adress, phone, and so on.

Bjorn
 
G

Guest

What is the best way to read single field values from a dataset? The dataset
is populated with a customer record, showing well in a gridview. But I also
want to read the single field values, like adress, phone, and so on.

Bjorn

for example, myDataSet.Tables[0].Rows[0][0]

it gives you a value of the first colum in the first row
 
B

Bjorn Sagbakken

Anon User said:
What is the best way to read single field values from a dataset? The
dataset
is populated with a customer record, showing well in a gridview. But I
also
want to read the single field values, like adress, phone, and so on.

Bjorn

for example, myDataSet.Tables[0].Rows[0][0]

it gives you a value of the first colum in the first row

Thanks a lot. That was exactly what I was looking for.

Bjørn
 
S

sloan

Is it a strong or weak typed DataSet?

Let's say you have
EmployeeDS
with one table : Employee
and 3 columns
EmployeeID (int) , LastName (string) , FirstName (string)


Here is some pseudo code:


EmployeeDS ds = new EmployeeDS();

ds.Employee.AddNewEmployeeRow ( 101, "Smith" , "John") ;

.........

EmployeeDS.EmployeeRow row = ds.Employee.Rows[0] as EmployeeDS.EmployeeRow;
// friendly cast
if(null!=row)
{
int empid = row.EmployeeID;
}
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top