Home > DeveloperSection > Forums > Can we assign a particular dataset column value to a variable
Elena Glibart
Elena Glibart

Total Post:33

Posted on    December-11-2014 10:32 PM

 ASP.Net C# 

 2 Reply(s)
 541  View(s)
Rate this:

I have a data set dsProcesses which returns some rows & columns.Now i need to store into a string all the data present in one particular column[Process-ID] of this data set.Can any one of u please suggest in a detailed way.

lois waisbrooker
lois waisbrooker

Total Post:70

Posted on    December-12-2014 6:08 AM

Yes you can

String str = DataSet.Tables[0].Rows[RowIndex]["ColumnNameOrIndex"].ToString();

String str = DataSet.Tables["TableName"].Rows[0]["ColumnName"].ToString();

Samuel Fernandes
Samuel Fernandes

Total Post:155

Posted on    December-12-2014 6:52 AM

try this...

DataSet ds = //call your data

        string sMyData = string.Empty;

        foreach (DataRow dr in ds.Tables[0].Rows)


            sMyData = sMyData + "," + dr["ProcessID"].ToString();


Don't want to miss updates? Please click the below button!

Follow MindStick