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
Alexey Smirnov - 07 Oct 2007 19:17 GMT
> 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
Bjorn Sagbakken - 07 Oct 2007 19:30 GMT
>> What is the best way to read single field values from a dataset? The
>> dataset
[quoted text clipped - 7 lines]
>
> 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
sloan - 08 Oct 2007 19:08 GMT
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;
}
> 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