Click here to Skip to main content
15,922,166 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a table Personal info, all customer must fill this up,

I have a Gridview and I want to display the user profile based on who is user that log in.
Posted

Make the query such a way that you don't have to write another one. For example,
SQL
SELECT * FROM User WHERE Email = @email and Password = @password

This would return all the records that has matched criteria.

Now, on Button_Click or any event of the control,
C#
SqlCommand cmd= new SqlCommand("your query", connectionObject);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);

userGridView.DataSource = dt;
userGridView.DataBind();

You can manipulate this code as per your requirements. This is just the basic idea how you can deal with your problem.

Hope this much is clear to you.
-KR
 
Share this answer
 
Comments
Member 10533469 22-Feb-14 4:37am    
Thank you Brother! :)
Krunal Rohit 22-Feb-14 9:18am    
Glad I could help :)
-KR
After User successfully logins, fetch his/her information from Database by a SQL Query using ADO.NET objects.

As you need to show on GridView, then use SqlAdapter Class and Fill your GridView.
 
Share this answer
 
Comments
Member 10533469 21-Feb-14 23:28pm    
Sir can you give an example for it,? im new to asp and i dont know some of the parts of it...
tnx for your response :)
You can't find the exact example. I can give you the article link, which will help to understand the concept of binding the data to GridView.

See - ASP.Net GridView- Insert Edit Update and Delete the ADO.NET way

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