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

Explain how cookies work.

0 Answers  


What is the difference between abstract class vs interface? Can give me the real time examples?

0 Answers  


What is parse in asp.net?

0 Answers  


can i use store procedure in disconnected mode? give me answer

2 Answers  


What does the "EnableViewState" property do?

2 Answers  


Is viewstate enabled by default?

0 Answers  


Explain how can we inherit a static variable?

0 Answers  


what is view state and its use

10 Answers   DELL, Efextra, HCL,


What is autopost?

0 Answers  


I’m having some trouble with cas. How can I diagnose my problem?

0 Answers  


Will the asp.net validators run in server side or client side? How do you do client-side validation in .net?

0 Answers  


What is web api and why to use it?

0 Answers  


Categories