Skip to content

Do others activity in same project while insert process is g

mohammad qasim

Asked May 23, 2013, 10:40 PM EDT1 answer
Share
LinkedInX
 

my criteria is
 
i have to insert thousands or more records using asp.net
 
what i want to do is ...

 let insert process going on and meanwhile i want to jump to other pages

or do some other activity while insert process is going on...

 

thanks in advance

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Sunny  Sharma
    0
    Hi...

    You can do this for sure. You can start a task that will keep running in background and you can perform some other task meanwhile.

    Below is sample snippet of the code that you need.
    ===========================================
    bool run = true; // to control the exit from the loops

    Task.Factory.StartNew(()=>{
    while(run)
    {
    ... // your code here

    }
    });

    ======================================

    This thread will keep running forever until run is true;

    You can also use a try..catch block inside the snippet to catch any unexpected/anticipated error.


    Please don't forget top accept this as answer if it helps you!
    Thanks.
    0