Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6126189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:20:28+00:00 2026-05-23T16:20:28+00:00

I am unable to update a selected text in ASP.NET textbox. I want to

  • 0

I am unable to update a selected text in ASP.NET textbox.
I want to edit the MySql database records using textbox. So, firstly I am selecting those values and adding them to textbox. After this I am trying to update the same textbox to which I retrieved my values. I cannot update those edited selected values.

I verified that my code works fine individually when I perform Select and Update separately. But I cannot use both at the same time.

 protected void Page_Load(object sender, EventArgs e) try
    {

        string MyConString = "DRIVER={MySQL ODBC 3.51 Driver};" + "SERVER=localhost;" + "DATABASE=malla_softmail;" + "UID=xxx;" + "PASSWORD=xxx;" + "OPTION=3";
        OdbcConnection MyConnection = new OdbcConnection(MyConString);
        try
        {
            MyConnection.Open();

            OdbcCommand cmd = new OdbcCommand("Select nickname, fullname, sex, age, city, country, company, zipcode, school, college, profession, maritial, local_search, public_search from awm_profiles where email=?", MyConnection);
            cmd.Parameters.Add("@email", OdbcType.VarChar, 255).Value = a;

            OdbcDataReader dr = cmd.ExecuteReader();
            if (dr.HasRows == false)
            {
                throw new Exception();
            }

            if (dr.Read())
            {
                tb_nickname.Text = dr[0].ToString();
                tb_fullname.Text = dr[1].ToString();
                dd_sex.SelectedValue= dr[2].ToString();
                dd_age.SelectedValue= dr[3].ToString();
                tb_city.Text = dr[4].ToString();
                tb_country.Text = dr[5].ToString();
                tb_company.Text = dr[6].ToString();
                tb_zipcode.Text = dr[7].ToString();
                tb_school.Text = dr[8].ToString();
                tb_college.Text = dr[9].ToString();
                tb_profession.Text = dr[10].ToString();
                dd_maritial.SelectedValue = dr[11].ToString();
                String local = dr[12].ToString();
                String web = dr[13].ToString();
                if(Convert.ToInt16(local) == 1)
                {
                lsearch.Checked = true;
                }
                else
                {
                lsearch.Checked = false;
                }
                if(Convert.ToInt16(web) == 1)
                {
                wsearch.Checked = true;
                }
                else
                {
                wsearch.Checked = false;
                }
            MyConnection.Close();
            }
        }
        catch
        {

        }
    }
    catch
    {

    }
}
protected void btn_profile_submit_Click(object sender, EventArgs e)
{

        a = Convert.ToString(Session["emailx10transfer"]);
        lbl_email.Text = a;
        tb_nickname.Text = aa;
        tb_fullname.Text = ab;
        dd_sex.SelectedValue = ac;
        dd_age.SelectedValue = ad;
        tb_city.Text = ae;
        tb_country.Text = af;
        tb_company.Text = ag;
        tb_zipcode.Text = ah;
        tb_school.Text = ai;
        tb_college.Text = aj;
        tb_profession.Text = ak;
        dd_maritial.Text = al;
       // lsearch.Checked = am;
       // wsearch.Checked = an;



   try
    {
        string MyConString = "DRIVER={MySQL ODBC 3.51 Driver};" + "SERVER=localhost;" + "DATABASE=malla_softmail;" + "UID=xxx;" + "PASSWORD=xxx;" + "OPTION=3";
        OdbcConnection MyConnection = new OdbcConnection(MyConString);
       MyConnection.Open();
        OdbcCommand cmd = new OdbcCommand("UPDATE awm_profiles SET nickname=?, fullname=?, sex=?, age=?, city=?, country=?, company=?, zipcode=?, school=?, college=?, profession=?, maritial=? WHERE email=? ", MyConnection);
        cmd.Parameters.Add("@tb_nickname", OdbcType.VarChar, 255).Value = tb_nickname.Text.Trim();
        cmd.Parameters.Add("@tb_fullname", OdbcType.VarChar, 255).Value = tb_fullname.Text.Trim();
        cmd.Parameters.Add("@dd_sex", OdbcType.VarChar, 255).Value = tb_fullname.Text.Trim();//dd_sex.SelectedValue.Trim();
        cmd.Parameters.Add("@dd_age", OdbcType.VarChar, 255).Value = tb_fullname.Text.Trim();//dd_age.SelectedValue.Trim();
        cmd.Parameters.Add("@tb_city", OdbcType.VarChar, 255).Value = tb_city.Text.Trim();
        cmd.Parameters.Add("@tb_country", OdbcType.VarChar, 255).Value = tb_country.Text.Trim();
        cmd.Parameters.Add("@tb_company", OdbcType.VarChar, 255).Value = tb_company.Text.Trim();
        cmd.Parameters.Add("@tb_zipcode", OdbcType.VarChar, 255).Value = tb_zipcode.Text.Trim();
        cmd.Parameters.Add("@tb_school", OdbcType.VarChar, 255).Value = tb_school.Text.Trim();
        cmd.Parameters.Add("@tb_college", OdbcType.VarChar, 255).Value = tb_college.Text.Trim();
        cmd.Parameters.Add("@tb_profession", OdbcType.VarChar, 255).Value = tb_profession.Text.Trim();
        cmd.Parameters.Add("@dd_maritial", OdbcType.VarChar, 255).Value = tb_fullname.Text.Trim();//dd_maritial.SelectedValue.Trim();

        //if (lsearch.Checked == true) { cmd.Parameters.Add("@localsearch", OdbcType.Int, 11).Value = "1"; }
        //else { cmd.Parameters.Add("@localsearch", OdbcType.Int, 11).Value = "0"; }
        //if (wsearch.Checked == true) { cmd.Parameters.Add("@wwwsearch", OdbcType.Int, 11).Value = "1"; }
        //else { cmd.Parameters.Add("@wwwsearch", OdbcType.Int, 11).Value = "0"; }
        cmd.Parameters.Add("@email", OdbcType.VarChar, 255).Value = a;

        cmd.ExecuteNonQuery();
        MyConnection.Close();
        Response.Redirect("profile.aspx");
    }
    catch (Exception Ex)
    {
        Response.Write(Ex);
    }   
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:20:29+00:00Added an answer on May 23, 2026 at 4:20 pm

    use if(!IsPostBack) function…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am unable to set my inbuilt database to update . It is always
using Microsoft.SqlServer.Management.SqlStudio.Explorer; unable to find this pls assist [update] found the dll's in this
I am unable to update the record in SharePoint 2010 using new linq feature.
I am unable to figure out how to update a milestone in baseCamp using
I have a asp:textbox with a OnTextChanged event that I want to fire when
I am currently using mysql database at server and for local sqlite in my
I have two dropdownlists inside an ASP.Net AJAX Update Panel. One dropdownlist populates the
I am unable to build my app because R.java will not update the ids.
I'm getting an Unable to obtain public key for StrongNameKeyPair. exception using Newtonsoft's JsonConvert.SerializeObject
UPDATE this is the screenshot of the alert: i am using the following JQuery

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.