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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:32:30+00:00 2026-06-15T02:32:30+00:00

How to properly do the following update: using (OracleConnection conn = new OracleConnection()) using

  • 0

How to properly do the following update:

using (OracleConnection conn = new OracleConnection())
using (selCmd)
{

    string sql1 = "update Table1 set name = joe where id = 10;"
    string sql2 = "update Table2 set country = usa where region = americas;"
    string sql3 = "update Table3 set weather = sunny where state = CA;"
    string sql4 = "update Table4 set engine = v8 where maker = benz;"

    cmdUpdate.CommandText = sql(#);
    cmdUpdate.Connection = conn;
    recs = cmdUpdate.ExecuteNonQuery();
}

I am aware of all or nothing if it’s a transaction but I just to see how it works with correct approach.

I’m thinking iterate an array of items [sql1,sql2,sql3,sql4] and pass sql(#) in the CommandText and perform ExecuteNonQuery each time.

  • 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-15T02:32:31+00:00Added an answer on June 15, 2026 at 2:32 am

    If I remember correctly, it is possible to concatenate multiple SQL statements in one string separated by semi-colons (;). Otherwise, there is nothing wrong with executing multiple ExecuteNonQuery() calls.

    string sql1 = "BEGIN update Table1 set name = 'joe' where id = 10;",
           sql2 = "update Table2 set country = 'usa' where region = 'americas';",
           sql3 = "update Table3 set weather = 'sunny' where state = 'CA';",
           sql4 = "update Table4 set engine = 'v8' where maker = 'benz'; END;";
    
    string sql = string.Format("{0}{1}{2}{3}",sql1,sql2,sql3,sql4);
    
    using (OracleConnection conn = new OracleConnection())
    using (OracleCommand cmdUpdate = new OracleCommand(sql, conn))
    {
        conn.Open();
        recs = cmdUpdate.ExecuteNonQuery();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Take the following property: public string Foo { get; private set; } Using reflection,
I am using the following code to update my mysql database String sql =
I am using following configuration to properly fit image inside a scrollview. <?xml version=1.0
Issue Using the following just simply doesn't work properly in -webkit- and -moz- browsers:
How do I properly setup the callback method for a status update using the
Update : Properly initialising string with char string[sizeof buffer - 1] has solved the
I'm using Visual Studio 2010. I have a class with the following constructor: CVideoAnnotation::CVideoAnnotation(std::string
I am using the following code. Why does it not run properly ? private
[UPDATE] To conclude this question, I implemented my graph using the following two methods
I am using following code to write the PATH, EXECUTABLE NAME and ARGUMENTS to

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.