Exemple #1
0
        private void btnBackup_Click(object sender, EventArgs e)
        {
            SQLServerUtils sqlServerUtils = new SQLServerUtils();

            string connection = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Master";

            try
            {
                sqlServerUtils.backup(connection, lstPrincipal.SelectedItem.ToString(), "C:\\projetos\\TesteSQLServerBackup.bak");
                MessageBox.Show("BACKUP DO BANCO DE DADOS " + lstPrincipal.SelectedItem + " FEITO COM SUCESSO !");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #2
0
        private void btnListagemBanco_Click(object sender, EventArgs e)
        {
            string connection = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Master";

            SQLServerUtils sqlServerUtils = new SQLServerUtils();

            string[] databases = sqlServerUtils.getDatabase(connection);

            string dataBasesList;


            foreach (string listaDB_loop in databases)
            {
                dataBasesList = listaDB_loop;
                lstPrincipal.Items.Add(dataBasesList);
            }
        }