Reading single field values from a dataset

Discussion in 'ASP .Net' started by Bjorn Sagbakken, Oct 7, 2007.

  1. 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
    Bjorn Sagbakken, Oct 7, 2007
    #1
    1. Advertising

  2. On Oct 7, 7:42 pm, "Bjorn Sagbakken" <> wrote:
    > 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
    Alexey Smirnov, Oct 7, 2007
    #2
    1. Advertising

  3. "Alexey Smirnov" <> wrote in message
    news:...
    > On Oct 7, 7:42 pm, "Bjorn Sagbakken" <> wrote:
    >> 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
    Bjorn Sagbakken, Oct 7, 2007
    #3
  4. Bjorn Sagbakken

    sloan Guest

    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;
    }








    "Bjorn Sagbakken" <> wrote in message
    news:...
    > 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
    >
    sloan, Oct 8, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    431
  2. Yasin cepeci
    Replies:
    1
    Views:
    305
    Alexey Smirnov
    Jun 4, 2007
  3. Replies:
    6
    Views:
    293
  4. Sound
    Replies:
    2
    Views:
    439
    Randy Webb
    Sep 28, 2006
  5. jr
    Replies:
    3
    Views:
    417
Loading...

Share This Page