Link to home
Start Free TrialLog in
Avatar of programmerist 1983
programmerist 1983Flag for Türkiye

asked on

How can i start a MultiThread Heavy Excel data to add Sql Table?


  i want to start Multi Thread while adding 20000 rows Excel Data to sql data.How can i do that?
 
Avatar of Gorkem Yuksel
Gorkem Yuksel
Flag of Canada image

Hi,

If you already have a method or function created for adding the rows, you can spawn a new thread to do this.  Below is a sample snippet that can get you started.  This example will start off the worker thread and return control back to your application.  You can take this one step further and fire off an event when the import is finished so you can notify the user that it has completed.

public void Form_Load()
{
// Main logic of code here....
// This is the point where the thread is branch off
Thread t = new Thread(new ThreadStart(StartProcess));
t.Start();
}

public void StartProcess()
{
      //Call the import function
      DoImport();
}

public void DoImport()
{
     // Do your import here..    
}

ASKER CERTIFIED SOLUTION
Avatar of BuggyCoder
BuggyCoder
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial