Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Apr 2010
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Update data on web form not updating database table

    I have a form with asp controls (textboxes, dropdowns, etc) that prefills data from the database. When i update any of the controls on the form and click the Next button click the data in the database table should be updated with modified data and I'm having trouble getting that to happen.

    Here is what I have in my button click event:

    Code:
    protected void NextButton_Click(object sender, Event Args e)
    {
                string rid = labelRID.Text
                string contnumber = contractnumber.Text;
                string solnumber = solicitationnumber.Text;
                string ordnumber = ordernumber.Text;
                string contstartdate = contractstartdate.Value;
                string contenddate = contractenddate.Value;
                string solstartdate = solicitationstartdate.Value;
                string solenddate = solicitationenddate.Value;
                string soltype = solicitationtype.Text;
                string pasnum = pasnumber.Text;
                
                
    
                    OracleConnection conn = new OracleConnection();  // C#
                    conn.ConnectionString = strConnection;
                    conn.Open();
    
                    OracleCommand cmd = new OracleCommand();
                    cmd.Connection = conn;
                    cmd.CommandText = "UPDATE CONTRACT_INFO SET  CONTRACT_NUMBER = :contnumber, SOLICITATION_NUMBER = :solnumber, ORDER_SELECTION = :orderselection, ORDER_NUMBER = :ordnumber, CONTRACT_START_PERIOD = to_date(:contstartdate, 'MM/DD/YYYY'), CONTRACT_END_PERIOD =  to_date(:contenddate, 'MM/DD/YYYY'), SOLICITATION_START_DATE = to_date(:solstartdate, 'MM/DD/YYYY'), SOLICITATION_END_DATE =  to_date(:solenddate, 'MM/DD/YYYY'), SOLICITATION_TYPE = :soltype, PAS_NUMBER = :pasnum, RID= :rid WHERE CONTRACT_INFO_ID = :contractid";
                   
                    cmd.Parameters.Add(new OracleParameter("contractid", contractid));                
                    cmd.Parameters.Add(new OracleParameter("contnumber", contnumber));
                    cmd.Parameters.Add(new OracleParameter("solnumber", solnumber));
                    cmd.Parameters.Add(new OracleParameter("orderselection", ordselection));
                    cmd.Parameters.Add(new OracleParameter("ordnumber", ordnumber));
                    cmd.Parameters.Add(new OracleParameter("contstartdate", contstartdate));
                    cmd.Parameters.Add(new OracleParameter("contenddate", contenddate));
                    cmd.Parameters.Add(new OracleParameter("solstartdate", solstartdate));
                    cmd.Parameters.Add(new OracleParameter("solenddate", solenddate));
                    cmd.Parameters.Add(new OracleParameter("soltype", soltype));
                    cmd.Parameters.Add(new OracleParameter("pasnum", pasnum));
                    cmd.Parameters.Add(new OracleParameter("rid", rid));
                    cmd.ExecuteNonQuery();
    
                    conn.Close();
                     response.redirect("contractor.aspx?Id=" + labelRID.Text
    }

  2. #2
    Master Coder sunfighter's Avatar
    Join Date
    Jan 2011
    Location
    Washington
    Posts
    6,717
    Thanks
    31
    Thanked 917 Times in 914 Posts
    Doesn't look like HTML to me. What is it?
    Evolution - The non-random survival of random variants.
    Physics is actually atoms trying to understand themselves.

  3. #3
    Regular Coder benanamen's Avatar
    Join Date
    Oct 2015
    Posts
    869
    Thanks
    2
    Thanked 89 Times in 86 Posts
    It's .NET and in the wrong category.
    To save time, lets just assume I am almost never wrong.

    The XY Problem
    The XY problem is asking about your attempted solution (X) rather than your actual problem (Y). This leads to enormous amounts of wasted time and energy, both on the part of people asking for help, and on the part of those providing help.

  4. #4
    Administrator VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    10,476
    Thanks
    6
    Thanked 1,229 Times in 1,199 Posts
    Quote Originally Posted by benanamen View Post
    It's .NET and in the wrong category.
    That’s what the report button is there for, so a moderator can get notified about threads to be moved accordingly (which I’ve done now).

  5. #5
    New Coder
    Join Date
    Apr 2010
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Wow 3 people responded and not one offered assistance.

  6. #6
    Regular Coder benanamen's Avatar
    Join Date
    Oct 2015
    Posts
    869
    Thanks
    2
    Thanked 89 Times in 86 Posts
    I'm sorry, I must have missed the rule where we are obligated to help you for free. If you had put your post in the correct forum to start with maybe you would have got an answer.
    To save time, lets just assume I am almost never wrong.

    The XY Problem
    The XY problem is asking about your attempted solution (X) rather than your actual problem (Y). This leads to enormous amounts of wasted time and energy, both on the part of people asking for help, and on the part of those providing help.

  7. #7
    New Coder
    Join Date
    Apr 2010
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by benanamen View Post
    I'm sorry, I must have missed the rule where we are obligated to help you for free. If you had put your post in the correct forum to start with maybe you would have got an answer.
    Wow that's the purpose of this forum is to get assistance on coding. And you definitely aren't helping in that department. Just stop posting and go back to picking your nose or something.

  8. #8
    Administrator VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    10,476
    Thanks
    6
    Thanked 1,229 Times in 1,199 Posts
    Please, don’t start a flame war over such a minor issue. mldardy, if you had posted in the right forum you wouldn’t have had to bother about three replies without a solution (now even more). Don’t let your frustration and impatience out on others who just clarified the situation.

  9. #9
    Regular Coder
    Join Date
    Sep 2014
    Posts
    165
    Thanks
    0
    Thanked 24 Times in 24 Posts
    Are you sure the callback NextButton_Click() is being executed.

    I haven't used oracle before so I can't help you. What I advice is if you are using Visual Studio, just attach to the IIS process (normally w3...), and put a breakpoint in NextButton_Click() just to make sure that it is being executed. You can then step through the statement one at a time. Most important is the value in contractid. If you don't see any IIS process, in the browser, just enter //localhost, to force the process to start.

    You can also start a debugging session on the page in question.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •