We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

loop through columns

How can I get a values that I entered into column through dataset? I have a column with User names. I would like to loop through that names to find a specific name.

1 Reply

AD Administrator Syncfusion Team May 13, 2005 01:21 PM UTC

If you want to loop directly though the datatable, you loop through the datatable1.Rows collection that contains DataRow objects. given a DataRow, dr, you get a particular column value by indexing it with teh column name.
for(int i = 0; i < dt.Rows.Count; ++i)
   DataRow dr = dt.Rows[i];
   string val = dr["ColumnName"].ToString();

Live Chat Icon For mobile
Up arrow icon