Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Data not updating on fields using UPDATE Statement

Data not updating on fields using UPDATE Statement

Scheduled Pinned Locked Moved ASP.NET
csharpdatabaseannouncement
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bootzilla33
    wrote on last edited by
    #1

    I have these fields set to the asp controls below:

    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;
    string commnts = comments.Text;
    string contkind = contractkind.SelectedItem.Text;
    string conttype = contracttype.SelectedItem.Text;
    string ponum = ponumber.Text;
    string instrtype = instrumenttype.SelectedItem.Text;
    string totcontractamount = totalcontractamount.Text;
    string estimloddate = estloddate.Value;
    string contfirstname = contractfirstname.Text;
    string contmiddleinit = contractmiddleinit.Text;
    string contlastname = contractlastname.Text;
    string lodsigned = datelodsigned.Value;
    string contractid = contractinfoid.Text;

    when I open the form to update some of these fields the fields don't update when I step thru the code and obviously don't update using this update statement to the database:

    OracleConnection conn = new OracleConnection(); // C#
    conn.ConnectionString = strConnection;
    conn.Open();

                OracleCommand cmd = new OracleCommand();
                cmd.Connection = conn;
                cmd.CommandText = "UPDATE CONTRACT\_INFO SET  CONTRACT\_SELECTION = :contractselection, 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, SURVEY\_REQUESTED = :preaward, PAS\_NUMBER = :pasnum, COMMENTS = :commnts, CONTRACT\_KIND = :contkind, CONTRACT\_TYPE = :conttype, PO\_ASSOCIATED = :poselection, PO\_NUMBER = :ponum, INSTRUMENT\_TYPE = :instrtype, TOTAL\_CONTRACT\_AMOUNT = :totcontractamount, EST\_LOD\_COMPLETION\_DATE = to\_date(:estimloddate, 'MM/DD/YYYY'), FIRST\_NAME
    
    Richard DeemingR Z 2 Replies Last reply
    0
    • B Bootzilla33

      I have these fields set to the asp controls below:

      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;
      string commnts = comments.Text;
      string contkind = contractkind.SelectedItem.Text;
      string conttype = contracttype.SelectedItem.Text;
      string ponum = ponumber.Text;
      string instrtype = instrumenttype.SelectedItem.Text;
      string totcontractamount = totalcontractamount.Text;
      string estimloddate = estloddate.Value;
      string contfirstname = contractfirstname.Text;
      string contmiddleinit = contractmiddleinit.Text;
      string contlastname = contractlastname.Text;
      string lodsigned = datelodsigned.Value;
      string contractid = contractinfoid.Text;

      when I open the form to update some of these fields the fields don't update when I step thru the code and obviously don't update using this update statement to the database:

      OracleConnection conn = new OracleConnection(); // C#
      conn.ConnectionString = strConnection;
      conn.Open();

                  OracleCommand cmd = new OracleCommand();
                  cmd.Connection = conn;
                  cmd.CommandText = "UPDATE CONTRACT\_INFO SET  CONTRACT\_SELECTION = :contractselection, 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, SURVEY\_REQUESTED = :preaward, PAS\_NUMBER = :pasnum, COMMENTS = :commnts, CONTRACT\_KIND = :contkind, CONTRACT\_TYPE = :conttype, PO\_ASSOCIATED = :poselection, PO\_NUMBER = :ponum, INSTRUMENT\_TYPE = :instrtype, TOTAL\_CONTRACT\_AMOUNT = :totcontractamount, EST\_LOD\_COMPLETION\_DATE = to\_date(:estimloddate, 'MM/DD/YYYY'), FIRST\_NAME
      
      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      Did you mean to say "fields", or did you mean "local variables"? Fields (C# Programming Guide)[^] Variables and Constants[^] If you're using fields, you're doing it wrong. :)


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      B 1 Reply Last reply
      0
      • Richard DeemingR Richard Deeming

        Did you mean to say "fields", or did you mean "local variables"? Fields (C# Programming Guide)[^] Variables and Constants[^] If you're using fields, you're doing it wrong. :)


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        B Offline
        B Offline
        Bootzilla33
        wrote on last edited by
        #3

        I mean I'm setting the variables : string contnumber equal to the asp form control text box: contractnumber.Text. And then I set those variables equal to the database fields in the update statement to update the database. When I make changes to fields on this form (textboxes, dropdowns,etc.) and click Submit button the fields don't get updated to the database. That's the problem that I need help with.

        1 Reply Last reply
        0
        • B Bootzilla33

          I have these fields set to the asp controls below:

          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;
          string commnts = comments.Text;
          string contkind = contractkind.SelectedItem.Text;
          string conttype = contracttype.SelectedItem.Text;
          string ponum = ponumber.Text;
          string instrtype = instrumenttype.SelectedItem.Text;
          string totcontractamount = totalcontractamount.Text;
          string estimloddate = estloddate.Value;
          string contfirstname = contractfirstname.Text;
          string contmiddleinit = contractmiddleinit.Text;
          string contlastname = contractlastname.Text;
          string lodsigned = datelodsigned.Value;
          string contractid = contractinfoid.Text;

          when I open the form to update some of these fields the fields don't update when I step thru the code and obviously don't update using this update statement to the database:

          OracleConnection conn = new OracleConnection(); // C#
          conn.ConnectionString = strConnection;
          conn.Open();

                      OracleCommand cmd = new OracleCommand();
                      cmd.Connection = conn;
                      cmd.CommandText = "UPDATE CONTRACT\_INFO SET  CONTRACT\_SELECTION = :contractselection, 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, SURVEY\_REQUESTED = :preaward, PAS\_NUMBER = :pasnum, COMMENTS = :commnts, CONTRACT\_KIND = :contkind, CONTRACT\_TYPE = :conttype, PO\_ASSOCIATED = :poselection, PO\_NUMBER = :ponum, INSTRUMENT\_TYPE = :instrtype, TOTAL\_CONTRACT\_AMOUNT = :totcontractamount, EST\_LOD\_COMPLETION\_DATE = to\_date(:estimloddate, 'MM/DD/YYYY'), FIRST\_NAME
          
          Z Offline
          Z Offline
          ZurdoDev
          wrote on last edited by
          #4

          Debug the code and watch what is happening. You'll solve it in no time.

          There are two kinds of people in the world: those who can extrapolate from incomplete data. There are only 10 types of people in the world, those who understand binary and those who don't.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups