Hashim Al-Arab
Hashim Al-Arab

Reputation: 164

Read from Dataset

I need to read value of the dataset. This dataset return many rows. and each rows have single value (Customer_Name)

Upvotes: 0

Views: 770

Answers (1)

Misha N.
Misha N.

Reputation: 3455

If you have one table in dataset and that table has one column you could do it like this:

foreach (DataRow row in dataSet.Tables[0].Rows)
        {
            string result = row[0].ToString();
        }

Or:

foreach (DataRow row in dataSet.Tables["tablename"].Rows)
        {
            string result = row["columnname"].ToString();
        }

Upvotes: 3

Related Questions