Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First let me thank you for your replies. </p> <p>Toby your answer got me thinking about thread monitoring my sql connections but it was a bit tricky and confusing since the app is still in develop and will use a lot more connections.</p> <p>S.Amani answer it wasn't quite what I want, but thanks to that I found a easier way. I created a form (could be anything else), placed a label saying: Saving To Data Base, took out the top bar, defined location and defined it's parent to be disabled when shown and enabled when closed. The following code is what I put inside my DataBaseInteractionClass</p> <pre><code>private Wait myCustomWaitDialog = new Wait(); // My Waiting form private void SaveToDatabase(myObjectToSave obj) // Method called to save data do DB { // Create the connections and queries (...) // This is what I did // Show Waiting Form myCustomWaitDialog.Show(); // Instanciate the command that will carry the query and to DB SqlCommand command = new SqlCommand(Queries.GetData(code), conn); // This is important //Create event that will fire when the command completes command.StatementCompleted += new StatementCompletedEventHandler(command_StatementCompleted); // Execute the transaction SqlDataReader reader = command.ExecuteReader(); // Rest of the code (validations, close connections, try/catch, etc (...) } void command_StatementCompleted(object sender, StatementCompletedEventArgs e) { // This is the method that closes my Waiting Dialog myCustomWaitDialog.CloseDialog(); myCustomWaitDialog.Dispose(); } </code></pre> <p>It's not quite what I want yet, but is the best solution that I found so far. For now it will do :) Anyway, thanks for the replies and I hope this helps someone else.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload