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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:57:34+00:00 2026-05-25T19:57:34+00:00

In my ASP.NET project, I create/open a SqlConnection when necessary, and close it at

  • 0

In my ASP.NET project, I create/open a SqlConnection when necessary, and close it at Application_EndRequest

Nevermind that, I am just wondering what would happen if, while a connection (say Connection A) is opened, the database is updated from another request (say Connection B).

So it’s like this

(Say initially x is 1)

A.Open()
B.Open()
B.UpdateX() –> SET x=2
B.Close()
A.SelectX() –> would this return 1 or 2?
A.Close()

  • 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-25T19:57:34+00:00Added an answer on May 25, 2026 at 7:57 pm

    The data returned depends on the state of the DB at the time you run the query and not at the time when you opened the connection.

    Let’s say you don’t use any specific transaction management in your code and let’s assume that the update statement is one distinct row or table update. In this case connection a will see X=2. this is because both connections will use the default transaction level which is read committed for both connections.

    Now, in your example there is no way to make connection A read X=1 if it is a single value update on a single row. But if you use a transaction on connection B and don’t commit and leave the connection open. The query for connection A will block until its timeout would expire. Basically, X would not be accessible until B was done.

    Also, If you are updating 10 million rows in one transaction of connection B and connection A was in a different thread and transaction. There is a possibility for connection A to read some old/stale/invalid data by using the transaction isolation level of “read uncommitted”.

    Hope this helps.

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

Sidebar

Related Questions

When I start a new ASP.NET project in Visual Studio, I can create an
I've had to create a custom membership provider for my current ASP .Net project
iv used the built in membership control for my ASP.net project, this create the
I'm trying to create a sitemap in an ASP.NET MVC project. This code in
I'm looking to create a fairly large-scale ASP.NET MVC project and I want to
If you create an ASP.NET web file project you have direct access to the
In VS2008, I go to File/New/Project, select ASP.NET Web Application and create a new
I just created a ASP.NET MVC project in VS2008. When I press F5 to
When I create a new ASP.NET project in Visual Studio 2010, it creates the
I am trying to create a .bat file that starts the ASP.NET Dev Server

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.