Aniket Narvankar

Aniket Narvankar

  • 566
  • 2.1k
  • 603.9k

Question on Asp.Net DataTable

Jun 15 2016 2:46 AM
I have a DataTable which contains 3 columns
 
id name val 
1  a        2
2  b        3
3  c        4
4  d       12
5  e       14
 
there are five variables string a,string b,string c,string d,string e.I want to assign a value,from name column a value which is 2 to variable a,similary b value to variable b.I have done it this way
 
a = dt.Rows[0]["val"]
b = dt.Rows[1]["val"]
c = dt.Rows[2]["val"]
d = dt.Rows[3]["val"]
e = dt.Rows[4]["val"] 
 
this is assigning values,but the way is going wrong.Please do let me know the other way i am stuck on this.
 
Regards,
Aniket Narvankar 

Answers (8)