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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:21:50+00:00 2026-06-11T14:21:50+00:00

I have a Winforms application that does some hefty database work. It does a

  • 0

I have a Winforms application that does some hefty database work. It does a lot of reading and some inserting of records. The operation can take up to 30 seconds to a minute, depending on the size of the database. Right now, my program works just fine.

My problem is, while my program is doing this, my UI thread is being blocked till the database stuff is done. I’d like to put the database functions into a thread, however, according to this MSDN article, ADO.NET is not thread-safe.

Is there a way to provide a progress bar on my UI or some way around the “ADO.NET is not thread safe”? Maybe to write my own classes that inherit SqlDataReader or SqlConnection to make it thread-safe. Is this even possible?

  • 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-11T14:21:51+00:00Added an answer on June 11, 2026 at 2:21 pm

    Just use a backgroundworker and make sure each thread (bgw) creates its own Connection object.

    And regarding to the linked article, make sure you have a Concurrency-safe way of generating keys. Letting the Db generate them is the best option.

    Is there a way to provide a progress bar on my UI

    That’s tricky. A Bgw can ReportProgress just fine but getting it from a running query is a problem. Even the total nr of rows is usually only known at the end.
    But you can always fake it, the user doesn’t mind/know.

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

Sidebar

Related Questions

I have a Winforms application that schedules some work using a service. The service
I have written a .net winforms application that does some heavy processing and slows
I have a WinForms application that requires some configuration which I do at install
I have an existing library (not a Winforms application) that supplies some Winforms to
I have a c#/winforms application that uses directx to play some video and audio.
We have a WinForms app, written in VB.NET (CLR 2.0), that does a lot
I've inherited a Winforms application that does a lot of long running calls into
I have a winforms applications that does some reporting using Crystal Reports for Visual
I have developed an application that pulls X amount of records from my database
I have an application (winform exe) that I run several times. Does this mean

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.