Application Freezes when executing large SQL scripts..

  • Thread starter Thread starter Carlo Goretti
  • Start date Start date
C

Carlo Goretti

Guest
Hey!

Need some tips how i can remove that my application freezes every time a script executing..
Here is my code:


if (lstChckBox.Checked == true)
{
testTick = 0;
TidPerSkriptTimer.Start();
server.ConnectionContext.BeginTransaction();
try
{ //Här läser den in skriptet.
server.ConnectionContext.CommitTransaction();
queryString = File.ReadAllText(files, Encoding.Default);
server.ConnectionContext.ExecuteNonQuery(queryString);

lstChckBox.Checked = false;
lstChckBox.ForeColor = Color.Green;
TidPerSkriptTimer.Stop();
//Ifall skriptet kunde köras blir texten grön.




}
catch (Exception sql)
{
server.ConnectionContext.RollBackTransaction();
lstChckBox.Checked = false;
lstChckBox.ForeColor = Color.Red;
MessageBox.Show("Detta skript gick inte att köra: " + Path.GetFileName(files).ToString() + "\n Följande fel:\n" + sql.GetBaseException().Message);
//Ifall skriptet inte kunde köras blir texten Röd.
TidPerSkriptTimer.Stop();
return;
}
//TidPerSkriptTimer.Stop();
fi = new FileInfo(files);
MessageBox.Show("Nu är " + fi.Name + " Kört!");
}
Best Regards

Continue reading...
 

Similar threads

C
Replies
0
Views
113
Carlo Goretti
C
Back
Top