If ExecuteQuery, if the method you want to execute, you can do:
void SomeMethod() {
var thread = new Thread(ExecuteQuery);
thread.Start();
}
void ExecuteQuery() {
}
If it ExecuteQueryreceives some parameters, for example:
void ExecuteQuery(string query) {
}
You can do:
var threadStarter = () => { ExecuteQuery("SELECT * FROM [Table]"); };
var thread = new Thread(ThreadStarter);
thread.Start();
If you want to stop the execution of a background thread, do not call the method thread.Abort(). It will be a killstream, and you do not want this, because some inconsistency may appear in your database.
bool, ExecuteQuery, True, . , , ExecuteQuery, True. , .
, bool volatile
Edit:
, , :
.
, ? . , , , ...
, , .