Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have following data table
C#
DataTable TableTransferNoteMain = new DataTable();
TableTransferNoteMain.Columns.Add("TrnNo",typeof(int));
for (int i = 0;i < 100; i++)
{
TableTransferNoteMain.Rows.Add(i) 

}//how to retrieve The Values of above table using column name like this 

for (int j = 0 ; j < TableTransferNoteMain.rows.count())
{
 int TrnNumber = TableTransferNoteMain.column["TrnNO"].value  // this is what i am expecting how to do this requirement 
}


how to retrieve a record by specifying a column name of a data table ?
Posted

1 solution

Hi Hope this will help you



C#
foreach(DataRow MainRow in TableTransferNoteMain.Rows)
{
int TrnNumber=int.Parse(MainRow["TrnNo"]);
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900