i want to update the exsistin user details in the database.
Here i want that when the user loged in the edit profile page is there and all the details of the user can be displayed in there perticuler area. and after that if user want to update it they may do that.
Its Very important So Please revert Back ASAP.


Just send me the code that you have written on [email snipped] and will try my best to help u..


Just send me the code that you have written on [email snipped] and will try my best to help u..


    SqlConnection Conn = new SqlConnection("Data Source=;Initial Catalog=;User Id=;Password=;");

        //Set Select  query
        string qry = "select * from users where users.uname = uname  ";
        SqlCommand SqlCom = new SqlCommand(qry, Conn);
       // SqlCom.Parameters.Add(new SqlParameter("@uname", (object)TxtUserName.Text));


        SqlDataReader RS = SqlCom.ExecuteReader();

            while (RS.Read())
                TextBox2.Text = RS["FullName"].ToString();
                TextBox4.Text = RS["PermanentAddress"].ToString();
                DDCurrentLocation.SelectedItem.Text = RS["CLocationId"].ToString();
                TextBox9.Text = RS["LandLine"].ToString();
                TextBox10.Text = RS["Mobile"].ToString();


Edited 3 Years Ago by mike_2000_17: Fixed formatting

I will explain you things using an example wher you want to display and update the information of the user uniquely identified with his UserId.The profile of users is shown/updated in page called UserProfile.aspx and the userId of person in example is 1. My Profile page has two asp Textboxes say, Name and EmailId and an update button to update the fields.

  1. On successful authentication of user in Login page, direct him to his profile page using Response.Redirect(Userprofile.aspx?UserId=1)

  2. Populate the values of user with Id = 1 from database/XML in Page Load event. The values should be populated only when IsPostBack = false condition is satisfied.

  3. Enter new values of Name and Email Id in corresponding text boxes and update them to database/XML file during the OnClick event of page. This will update the values of user and show the new values of user in page.

Please refer the code for more understanding:

protected void Page_Load(object sender, EventArgs e)
    if (!IsPostBack)
       txtName.Text = "name value from database";
       txtEmail.Text = "email from database";

protected void btnUpdate_Click(object sender, mageClickEventArgs e)
    // Update Query for database/XML file with new values
   "name value from database" = txtName.Text;
   "email from database" =  txtEmail.Text;

If you still have any confusions you can contact me.

Edited 3 Years Ago by pritaeas: Fixed formatting

This article has been dead for over six months. Start a new discussion instead.