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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T19:47:23+00:00 2026-05-16T19:47:23+00:00

When using a generic DbCommand to perform an update, it will hang indefinately if

  • 0

When using a generic DbCommand to perform an update, it will hang indefinately if the row being updated is locked.

The underlying connection used is is Devart’s Oracle provider, Devart.Data.Oracle.OracleConnection

Setting the DbCommand.CommandTimeOut has no effect at all, the update never times out.

DbCommand does not implement BeginExecuteNonQuery, so there seems to be no way to use DbConnection/DbCommand in an asynchronous manner.

I am able to get around this by using Devart’s OracleCommand and BeginExecuteQuery, but it does .

Is there a way to do this in a generic way?

Simplified code for the oracle specific logic:

public bool TestAsyncUpdateRowOracle(string key, OracleConnection con, string sql)
{
    const int timoutIterations=10;
    bool updateOk=false;
    OracleCommand cmd = new OracleCommand(sql, con);
    cmd.Parameters.Add(Util.CreateParameter(dbSrcFactory, DbType.String, 16, "key"));
    cmd.CommandType = CommandType.Text;
    cmd.Parameters[0].Value = key.ToString();

    IAsyncResult result = cmd.BeginExecuteNonQuery();
    int asyncCount = 0;
    while (!result.IsCompleted)
    {
        asyncCount++;
        if (asyncCount > timeoutIterations)
        {
            break;
        }
        System.Threading.Thread.Sleep(10);
    }

    if (result.IsCompleted)
    {
        int rowsAffected = cmd.EndExecuteNonQuery(result);
        Console.WriteLine("Done. Rows affected: " + rowsAffected.ToString());
    }
    else
    {
        try
        {
            cmd.Cancel();
            Console.WriteLine("Update timed out, row is locked");

        }
        catch (Exception e)
        {
            Console.WriteLine(e.ToString());
            Console.WriteLine("Unable to cancel update");
        }
    }
    cmd.Dispose();
}
  • 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-16T19:47:24+00:00Added an answer on May 16, 2026 at 7:47 pm

    Sadly, no, there is no interface or base class in ADO.NET that has async operations (e.g. BeginExecuteNonQuery / EndExecuteNonQuery). They’re only present in very few ADO.NET provider implementations. (SqlClient, Devart Oracle).

    That said, if it doesn’t time out when a CommandTimeOut is set, in my opinion that’s a bug in the provider.

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

Sidebar

Related Questions

I m using generic view to update object. I m using form : class
I'm wondering if using generic types through out the program will have any (significant)degrading
I am using generic code (from the iOS Fireworks demo) in a slightly changed
About five years ago I started using Generic lookup Tables for applications I was
I made in my web a menu using generic_view - simple 'django.views.generic.list_detail.object_list' in urls.py
I m populating data for different entities into set of lists using generic lists
I am using a generic error page using ASP.NET's <customErrors> directive. <customErrors mode=On defaultRedirect=500.html
I'm trying to streamline my existing repos by using a generic repo I can
I'm trying to implement the repository pattern using a generic repository like the one
AssemblyInstaller.Install expects a System.Collections.IDictionary. Am I right to be 'allergic' to using non-generic collections

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.