[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

C Sharp - Return dataset row as a string

Posted on 2012-09-10
1
Medium Priority
?
365 Views
Last Modified: 2012-09-10
Hi.

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.
0
Comment
Question by:Jasmin01
1 Comment
 
LVL 16

Accepted Solution

by:
Easwaran Paramasivam earned 1000 total points
ID: 38382958
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.
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question