.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Can i use Threading for this scenario

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :.NET Framework


We are going to start a new project. The requirement is to Get the data from 4 databases by executing a stored procedure. We have the same data in all the databases and the SP is also present there. Since the credentials used to execute the SP is different, i am going to call the SP 4 times from the application and will merge the data. But if the processing fails or hangs, i want to exeute the same process again. This can be a windows/console application and i will schedule this in the windows task scheduler to execute as a job. So no user interaction will be there. The question here is how do i re-run this application if an exception occurs.? Is it a good oractice to use Thereading for this purpose?



View Complete Post

More Related Resource Links

Hello World to C# Threading Part 1

In this post we will see how we can implement simple threading. Why do we need threading? When you want you application to do more then one thing at same time, then you need to implement threading. One usual and common scenario would be when your application needs to get data from some other resource like web services and you don't want you application GUI to be freeze during this time. In that sort of case you will run the code to access web services in separate thread so your application GUI won't freeze. The System.Threading namespace .NET provide interfaces to implement multi threading.

Threading in C#

What is Threading?
-Parallel execution of code pieces on CPU, commonly compiled codes started in a single thread but it is possible to create multi-threads within a program.


Multi-core processors are new standards on the user's hardware. By taking advantage of the multi-processing capabilities of these machines you can achieve significant performance upgrade with some minor changes in your code. When an application does not make use of threading techniques it is wasting valuable resources. This tutorial will cover the basic threading concepts and threading methods and properties.

Multi-threading in .NET: Introduction and suggestions

This article uses the C# type shorthands throughout - int for Int32 etc. I hope this makes it easier for C# developers to read, and won't impede any other developers too much. It also only talks about the C# ways of declaring variables to be volatile and locking monitors. Developers using other languages can find the equivalents in their own preferred environment, I'm sure.

Multiple Paramatized Threading issue


I need the funcitonality to have two methods run concurrently of each other and the parent thread (aka the method that makes these two calls) to halt until BOTH are done. After the threads are done, I need to perform logic on the returns of the method, so it is essential for both of them to be complete before the parent thread continues. I have searched the internet and tried varous attacks, and I always come up with the same result, this being the parent thread continues operation after the first thread finishes, leaving the second thread running.  Can someone show me a quick example of how I can do this. I have tried checking states of the threads, halting the threads, but I always end up with the same thing. Any help would be great. Thanks.

How to set SearchRoot Path in Active Directory in this scenario


How to set SearchRoot Path in Active Directory in this scenario:

Functionality: We have scenario that 1<sup>st</sup> hit one LDAP server with some 'fixed user name' &' fixed password ' and filter data with specific User name(which given by user) getting 'User dn'.

After that we hit Next LDAP server based on the 'User dn' getting from 1<sup>st</sup> server.

(So, in my case 1<sup>st</sup> LDAP server works like as Load balancing server but functionalitywise it is different)


Make It Snappy: Juice Up Your App with the Power of Hyper-Threading


In this article, the author explores the hyper-threading technology found on newer Intel Pentium 4 processors and demonstrates how adding parallelism to your code can improve performance on hyper-threaded machines. He covers advanced optimizations for hyper-threading and shows a number of useful patterns. Code samples are in C#, but you can apply the same principles in other languages as they apply to both managed and unmanaged applications.

Yaniv Pessach

MSDN Magazine June 2005

Threading: Break Free of Code Deadlocks in Critical Sections Under Windows


Critical sections, a mechanism that prohibits more than one thread at a time from executing a particular section of code, is a topic that has not received much attention and thus tends not to be well understood. A solid understanding of critical sections in Windows can really come in handy when you need to track down multithreading performance issues in your code. This articles delves under the hood of critical sections to reveal information useful in finding deadlocks and in pinpointing performance problems. It also includes a handy utility program that shows all of your critical sections and their current states.

Matt Pietrek and Russ Osterlund

MSDN Magazine December 2003

Visual Basic .NET: Tracing, Logging, and Threading Made Easy with .NET


Visual Basic has always been a language of innovation, but at the same time it's left its proponents wanting certain high-level features. With the upcoming version, Visual Basic .NET, the language takes advantage of the Microsoft .NET Framework to provide several new features that will be vital to developers. This article begins by discussing tracing and error logging in Visual Basic .NET. Next, you'll see how to write a Windows service without third-party help. Monitoring the file system, a previously daunting task, is also covered. Finally, the author ties these concepts together with a sample application that waits for XML files to be deposited in a directory and then imports them into SQL Server database.

Yasser Shohoud

MSDN Magazine July 2001

System.Threading AND email


Hi guys,

I really need some help (and also some code example), in how to use System.Threading to send emails.

The issue is:

a) I have a function that sends emails;

b) But I don't want to keep the customers waiting for the email being sent;

c) so, I figure it out that the System.Threading is the best way to do that; But I don't know how exactly I cant use it.

PLEASE, i'm VB - not C# - developer, and I really appreciate help in that language.

I can't use Windows Services or SQL Jobs...

Could you help me on this?



How can I implement this workflow scenario with SharePoint Designer?



I have a document content type and a library which contains this content type. here is what I want to do:

- when user creates a new document in this library, he will enter some user  names with people picker and then a message including some columns of the content type will be sent to that users. And then, at a certain date (lets say 1 day before a date that is one of the site columns) another email, a reminder will be sent.

I havent been able to find :

1- how can I replace a people picker field on workflow initiation form and how can I make it sent email to the user.

2- How can I make it sent a reminder email 1 day before the date that is stored in one of the columns of the content type(current item)

any help would be welcome,


Quick Note (Scenario): Getting Started with Data Access in SharePoint 2010

The goal of these exercises is to give you the steps that you need to access data from various sources by using web development tools and technologies such as SharePoint 2010 and Visual Studio 2010.

Quick Note (Scenario): Getting Started with Web Development in SharePoint 2010

The goal of these exercises is to provide you with the steps necessary to develop Web solutions by using Web development tools and technologies such as SharePoint 2010 and Visual Studio 2010.

asp.net c# DELEGATE THREAD: Multi threading



In my asp.net web application i have lengthy excution process like word merge. I want to merge the word documents and send to client in a procedure. Basically i am looking for run and forget kind of asynchronous process.

In my for loop i tried to create delegate and rstrat. like this

filenames is a string array, creating in the same loop and assiging values before calling delegate.


MailSender mail = new MailSender();



TestDelegate testdele = new

MVC with Javascript/AJAX scenario



I'm a rookie with Javascript/Ajax and I was hoping someone could provide an code example or advice of the following scenario:

1.  User clicks a button on the view

2.  Display a message "Waiting to be processed".  (Currently using Javascript)

3.  Execute the action method to retrieve some data.  (Call made from the Javascript)

4.  Return the same view.

5.  Open up a new browser window with a URL that was obtained from the action method.

How do I open a new browser window automatically after the action method is complete?  I was previously making the following call (Process.Start(http://www.yahoo.com);) in the action method but I'm running into issues with it.  I'd like to use Javascript/Ajax.


If it helps this the javascript code that is run when the button is clicked:

function runReportMessage() {
    document.getElementById("runReport").innerHTML = "Running the report. Please wait";
    document.getElementById("btnRun2").disabled = "

query string or session variable or neither for this scenario?

Hello,example scenario: user login has a list of associated 'accounts' it has access to... this list of accounts is stored in a database table, say tblAccountAccessControl, something like:login, accountID-----------------------userA, account123userA, account456userA, account798userB, accountABCuserB, accountDEFetc..this info is used throughout the web application and determines the 'domain' of information the particular login has access to. For example there are many other tables that have the 'accountID' field and whenever a page pulls data from the table it only pulls data that the currently logged in user should be allowed to see, based on that tblAccountAccessControl data.the security question:1) do I need to query the database every time I need to get this list of allowed accountID's? I was about to use a plain old query string to pass a particular accountID to another page but quickly caught myself as I realized that would be a major security flaw (the receiving page was going to use that accountID to grab info from the database, and there would be nothing preventing a user from simply typing in a url manually to get data from an accountID they are not supposed to be allowed to view). So I then thought I'll just store the list of accountID's in a session state variable so they will be carried with the user throughout the sessi
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend