Click here to Skip to main content
15,741,215 members

Comments by StackQ (Top 200 by date)

StackQ 22-Dec-16 7:11am View    
Thanks alot
StackQ 29-Nov-16 5:26am View    
First thanks for your solution.
I am new to c#, so not aware with threading,as my main skill is SQL Server. Could you please help a bit more here how to declare myThread and so on?

Actual button from where I am processing whole work:-
private void btnNext_Click(object sender, EventArgs e)
{
OpenFileDialog opn = new OpenFileDialog();
opn.InitialDirectory = "C:\\";
opn.Filter = "xml files(*.xml)|*.xml";
if(opn.ShowDialog()==DialogResult.OK)
{
string str = opn.SafeFileName;
//string str = "C:\\TextReader\\";
XMLReaders(opn.FileName.Replace(str,""), opn.FileName); //Doing my work, it's definition is above in my main question
}
}

I want to Pause/Resume loop exist in above function:- XMLReaders(), which started by another button's click event, from here (below click event of button):-
private void btnPR_Click(object sender, EventArgs e)
{

}

However I am trying to implement your solution, but will appreciate your help (will be easier for me :)
StackQ 29-Nov-16 4:53am View    
Deleted
it will not work coz, I am processing loop, from Click event of Button
StackQ 29-Nov-16 4:49am View    
//Why I am looking for this
I extract list of .sql files from xml file, then open each .sql file and do some text extraction to extract table name, and then I create required script with help of these extracted tables names in a loop, one by one

Required answers of above comment:-
-To process one item it will hardly take 1-2 seconds.
-When pausing, don't want to terminate anything, just want to pause it.(Suppose I have 10 .sql file, in loop if i=5, means I processed 5 files, now if paused then it will get pause,and if resume from here after 10-15 minutes then processing should get start from i=6, means from 6th file)
-How many item do you have?> I have xml file where there will be list of .sql file, max number of .sql file count will be 400 to 500

And yes I don't want to keep the connection open, while in pause state. But it will be not an issue, coz it's UAT environment,and everything handled only with Global Temp table and temp stored procedures only. There is no actual object involved from database.
StackQ 25-Nov-16 4:44am View    
check google or check my similar question link:-
http://www.codeproject.com/Questions/450479/Export-to-multiple-sheet