How to retrieve data row by row from a DataTable?
Thanks In advance
PriyaPP
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
What are asp.net web forms?
what is session ?how sessions are handeled in application? write the clauses of sql server in their order.
What are the disadvantages of asp.net?
7. Do you have reference list?
4 Answers CMC, Hotel Jobs, Mannar Company, Qatar Petroleums, Swatz Oils,
How can you dynamically add user controls to a page?
How can we Validate a Controls in ASP.NET page using JavaScript?
Which method do you use to enforce garbage collection in .net?
Difference between Dataset and DataReader ?
4 Answers Accenture, BirlaSoft, Infosys, Microsoft, Techseol,
Why the javascript validation not run on the asp.net button but run successfully on the html button?
How do I force the dispose method to be called automatically, as clients can forget to call dispose method?
What is smart navigation?
How does SQL Server session state works
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)