Click here to Skip to main content
15,889,462 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi, i have a C# application whenever i try i read/write to database the application go to not responding state so i can not do anything but wait for it to finish and some times it crashes. So what i can do to stop this state?
Posted
Comments
Md. Rashim Uddin 26-Sep-11 2:31am    
Is it for win form application?
Yousif Mazeh 26-Sep-11 2:32am    
yes
Sergey Alexandrovich Kryukov 26-Sep-11 2:33am    
Not enough information.
--SA
Yousif Mazeh 26-Sep-11 2:34am    
what information u need?

1 solution

Use a separate thread for it. On top of each thread catch all exceptions and notify main UI thread on every exception using Control.Invoke.

—SA
 
Share this answer
 
Comments
Yousif Mazeh 26-Sep-11 2:37am    
can u give me a tutorial link on doing that?
Simon Bang Terkildsen 26-Sep-11 2:43am    
I simple tutorial is not enough, if you want to do multithreaded programming you have to dedicate a good amount of time and probably some money for a good book. Multithreaded programming is not a simple task, even though SA makes it sound like it.
Yousif Mazeh 26-Sep-11 2:46am    
hey simon, so can i find another solution without using multithreading?
Sergey Alexandrovich Kryukov 26-Sep-11 2:54am    
Forget about it; don't invite troubles. Use multithreading.
--SA
Simon Bang Terkildsen 26-Sep-11 11:37am    
Like SA says this requires multithreading. All I'm saying is that I do not find it wise to use multithreading if you don't know a good deal about it.
I myself have learn through trail and error, it's only the past few years I've realized the value of books. I took me atleast 4 years of trail and error and debugging multithreaded issues before I had a good understanding of multithreading, even today I do not take multithreaded programming litely and any developer (even very seasoned developers) who does will be in for a world of trouble sooner or later, this is my belief not a fact. though I feel so strongly about it that I often state it as a fact.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900