Click here to Skip to main content
15,891,850 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
tablename User

Id           int                   
Email         varchar(500)
Password       varchar(500)
Name            varchar(500)


DATA IN TABLE IS
Id Email          Password Name 
1  ali@yahoo.com   1234     ali
2  usman@yahoo.com  1234    usman


i ask you about simply how datatable working
is
C#
Label1.text=datatable.Rows[0]["Name"].Tostring();
for Row ali@yahoo.com 1234 ali
and Label1.Text=datable.Rows[1]["Name"].Tostring(); is for row usman@yahoo.com 1234 usman


1 ali@yahoo.com 1234 ali          // is this is row 0?

2   usman@yahoo.com  1234  usman      // is  this is row1?
Posted
Updated 8-May-11 22:05pm
v4

1 solution

Take the ID in session. And in Pageload make a query and fetch the name with respect to id like "Select * from User where Id='+Session["ID"].Tostring()+"'".

And then Label1.text= ....... .


Hope this can help you.
 
Share this answer
 
v2
Comments
umairshoaib 9-May-11 3:48am    
i undestand kown about Datatable.Rows[0] how it works

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