How to retrieve data row by row from a DataTable?
Thanks In advance
PriyaPP

Answers were Sorted based on User's Feedback



How to retrieve data row by row from a DataTable? Thanks In advance PriyaPP..

Answer / guest

foreach(Datarow dr in table.rows)
{
string str = dr[0].ToString();
string str1 = dr["columnName"].ToString();

}

Is This Answer Correct ?    11 Yes 3 No

How to retrieve data row by row from a DataTable? Thanks In advance PriyaPP..

Answer / suyash deep

best way to retrieve data is-
//dtTable is Data table
//dtrow id Data Row object


string str;
foreach(DataRow dtrow in dtTable.rows)
{

str= dtrow ["emp_Name"].Tostring();
//emp_Name is the column name

// now use str variable as you want to manipulate.
}

Is This Answer Correct ?    6 Yes 0 No

How to retrieve data row by row from a DataTable? Thanks In advance PriyaPP..

Answer / digvijay

In C#

foreach(DataRow dr in dt.rows) //dt is Data table
{

string ABC= dr["Coloumn_Name"].Tostring;

}

Is This Answer Correct ?    3 Yes 2 No

Post New Answer

More ASP.NET Interview Questions

what is postback implementation?when pre-render event n init event is fired?

2 Answers   Ness Technologies,


In cache where dats is stored and how(file or object?)

2 Answers  


What is the use of session in web application?

0 Answers  


What is a response cookie?

0 Answers  


How many web.config files can I have in an application?

0 Answers  






Differentiate between a hyperlink control and a linkbutton control.

0 Answers  


and can u telme how to explain about our job profile if i have 3years of it experiance in dotnet domain and where to start and where to end , and what shoul i tel and what not(can i mention my education ,and family details,......)i am confusiong a lot. can i ask one with your permision, if u have question that u u went tcs interview as 3+years exp so he/she asked tel me about your profile how can u tel and where to stop. please help me as simple as possible i am facing lot in this..............plese can anyone help me i am awaiting for your reply.

1 Answers   TCS,


How can we prevent browser from caching an aspx page?

0 Answers  


For a server control, you need to have same properties like color maxlength, size, and allowed character throughout the application. How do you handle this?

2 Answers   Microsoft,


Give an example appropriate use forweb service as opposed to a non-serviced .NET component

1 Answers   Siebel,


What is redirecting behavior?

0 Answers  


Where is the session stored?

0 Answers  


Categories