C# Display MySql script being executed in a textbox of some sort in WPF

Viewed 20

I'm doing a small program that restores a selected database from a file into a specific server. I finally got all the other steps done, and now i just wanted to add a Textblock or Datagrid showing the query being executed. Can any1 help me out? I'm kinda new to this... Thanks so much.

private void Button_Click_Restore(object sender, RoutedEventArgs e)
{
    string dbInfo = "DATABASE=" + Database.Text;
    string connectionString = "SERVER=" + Hostname.Text + ";" + dbInfo + ";" + "UID=" + User.Text + ";" + "PASSWORD=" + Password.Text + ";" + "PORT=" + Port.Text;
    
    MySqlConnection conn = new(connectionString);
    MySqlScript restore = new(conn, File.ReadAllText(txtEditor.Text));
    
    try
    {
        conn.Open();
        restore.Execute();
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
    RestoringText.Text = "Restored successfuly!";
    conn.Close();
    
}
0 Answers
Related