C Sharp - Return dataset row as a string


I have the following line of code:  

tRow = dsSourceData.Tables(0).Rows(iCount)

I would like to return the row from this dataset to a string.  Can anyone help me?  Mere;y adding a .ToString at the end does not give me the result I am looking for.
Who is Participating?
Easwaran ParamasivamConnect With a Mentor Commented:
In datarow there could be more columns. You have one option.

If you want particular column then you could use below code:

this.mUsername = tRow ["Username"] as string;

Or If you want entire row

StringBuilder result = new StringBuilder();
string seperator = "|";

foreach(DataColumn dataColumn in myDataTable.Columns)
      result .Append(tRow[dataColumn].ToString().Append(seperator);

string entirerowvalues = result.ToString();

Please do refer http://forums.asp.net/t/1012024.aspx/1 and http://forums.asp.net/t/310397.aspx/1 for more information.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.