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

Define xmlvalidatingreader class.

0 Answers  


What are the intrinsic objects present in ASP.NET

1 Answers   IBM,


How to refresh a page in asp.net

4 Answers  


What is the maximum length of textbox

1 Answers  


What is a WebService and what is the underlying protocol used in it? Namespace?

1 Answers  






Why do we use Option Explicit?

2 Answers   Microsoft,


About DataAdapters ?

8 Answers   Accenture,


Explain about asp.net 2.0 themes?

0 Answers  


Explain what are delegates?

0 Answers  


Define web services in asp.net.

0 Answers  


What method must be overridden in a custom control? a) The Paint() method b) The Control_Build() method c) The Render() method d) The default constructor

1 Answers   Icertis, Microsoft, Syntax Softtech,


What are the asp.net server side objects?

0 Answers  


Categories