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 7780039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:47:58+00:00 2026-06-01T18:47:58+00:00

I have a web form. There are 20 fields that correspond to the columns

  • 0

I have a web form. There are 20 fields that correspond to the columns in a database table. Let’s say there’s one record that has a BIRTHDATE column and I change its value from 13-July-2000 to 12-FEB-1985. But I don’t touch the rest of the columns. Is there a way in C# to run an update statement like this:

UPDATE TABLE1 SET BIRHDATE=NEWVALUE WHERE ID=1111

instead of updating all the columns of the row like this:

UPDATE TABLE1 SET COLUMN1=NEWVALUE1, COLUMN2=NEWVALUE2,......,BIRTHDATE=NEWVALU

I think it would be a waste of resource. Am I wrong? I think DataAdapters are for this purpose but I’m not sure.

  • 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-06-01T18:47:59+00:00Added an answer on June 1, 2026 at 6:47 pm

    You can send a direct update statement to the Oracle Engine in this way.

    using (OracleConnection cnn = new OracleConnection(connString)) 
    using (OracleCommand cmd = new OracleCommand("UPDATE TABLE1 SET BIRHDATE=:NewDate WHERE ID=:ID", cnn)) 
    { 
            cmd.Parameters.AddWithValue(":NewDate", YourDateTimeValue);
            cmd.Parameters.AddWithValue(":ID", 111);
            cnn.Open(); 
            cmd.ExecuteNonQuery(); 
    }
    

    EDIT:

    If you don’t know which fields are changed (and don’t want to use a ORM Tool) then you need to keep the original DataSource (a datatable, dataset?) used to populate initially your fields. Then update the related row and use a OracleDataAdapter.

    using(OracleConnection cnn = new OracleConnection(connString)) 
    using (OracleCommand cmd = new OracleCommand("SELECT * FROM TABLE1 WHERE 1=0", cnn))  
    {
         OracleAdapter adp = new OracleDataAdapter();
         adp.SelectCommand = cmd;
         // The OracleDataAdapter will build the required string for the update command
         // and will act on the rows inside the datatable who have the  
         // RowState = RowState.Changed Or Inserted Or Deleted
         adp.Update(yourDataTable);
    }
    

    Keep in mind that this approach is inefficient because it requires two trip to the database. The first to discover your table structure, the second to update the row/s changed. Moreover, for the OracleDataAdapter to prepare the UpdateCommand/InsertCommand/DeleteCommand required, it needs a primary key in your table.

    On the contrary, this is handy if you have many rows to update.

    The last alternative (and probably the fastest) is a StoredProcedure, but in this case you need to go back to my first example and adapt the OracleCommand to use a StoredProcedure, (Add all fields as parameters, change CommandType to CommandType.StoredProcedure and change the text of the command to be the name of the StoredProcedure). Then the StoredProcedure will choose which fields need to be updated.

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

Sidebar

Related Questions

I have a web form that has 2 radio buttons, depending on which one
I have a web form. There are many different sections. I can say that
I have a web form that manipulates records in a MySQL database. I have
I have a huge ASPX web form which has around 100 fields which need
I have a form on a simple web page that has a series of
I have created one web app using mvc and in that used form authentication
I have a web report that uses a Django form (new forms) for fields
Situation: you have a web page with a form that has a first name
I have web form with a panel which has form elements in side it.
I have a web form that collects information and submits it to a cgi

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.