Set variable equal to value in datatable

cpopham

Well-known member
Joined
Feb 18, 2004
Messages
273
I want to set a variable equal to the third datacolumn named "myUser" on the first datarow of my datatable named "users". Anyone know how to do this?

Thanks, Chester
 
Assuming your table is coming from a DataSet:
Code:
DataSet ds = new DataSet();

DataTable dt = ds.Tables["users"];

string myVal = Convert.ToString(dt.Rows[0]["MyUser"]);
 
Back
Top