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

Features and disadvantages of dataset ?

4 Answers   Interlink, Microsoft,


Mention the execution process for managed code?

0 Answers  


Why is an object pool required?

0 Answers  


hi ans dis qstn. "what is d max size of query string. If it exceeds does it give error. if yes wt error it gvs, if no gv the reason" thnx in advance

3 Answers  


how we deploy the asp.net 2.0 application

2 Answers   Logistics,


what does Page.IsValid in asp.net

6 Answers   Infosys, Net Solution,


What are Master Pages in ASP.NET?

0 Answers  


What are type/key pairs in client script registration? Can there be 2 scripts with the same type/key pair name?

0 Answers  


What’s the difference between asp.net web forms and asp.net mvc?

0 Answers  


What is data caching?

0 Answers  


What object is used to encapsulate a rowset? a) DataSet b) DataAdapter c) DataRowSet d) DataTable

2 Answers   Syntax Softtech,


Hi, I Dont know about Application and Session State management. Can anyone explain me with simple example?

1 Answers  


Categories