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 application state?

0 Answers  


What are merge modules?

0 Answers  


What are the various authentication mechanisms in ASP.NET ?

1 Answers   Digital GlobalSoft, Satyam,


What is xaml? Are xaml file compiled or built on runtime?

0 Answers  


Types of objects in ASP?

8 Answers   Beget, Microsoft,






Describe the two main components of the .NET framework ?

2 Answers  


What is a postback ispostback and autopostback in asp net?

0 Answers  


Define application state variable and session state variable?

0 Answers   UGC Corporation,


Details on web.config and global.asax - just explain what are the sections will be there.

1 Answers   Syntel,


About Garbage Collector?

3 Answers   Microsoft,


Why session is necessary in web application?

0 Answers  


How do you set language in web.cofig ?

3 Answers   Keane India Ltd,


Categories