Jump to content
Sign in to follow this  
drcc

Backup BD

Recommended Posts

drcc

Boas,

deixo aqui mais uma pergunta... como posso fazer um backup da base de dados em MYsql através do vb, de preferência queria que o utilizador pudesse escolher a pasta do backup...

Cumprimentos.

Share this post


Link to post
Share on other sites
drcc

Fica aqui o codigo para para escolher a directória para onde quer guardar:

       

Dim saveFileDialog1 As New SaveFileDialog()
        saveFileDialog1.InitialDirectory = "Ambiente de trabalho"
        saveFileDialog1.Filter = "Ficheiros sql (*.sql)|*.sql"
        saveFileDialog1.FileName = "BackupBD"
        saveFileDialog1.FilterIndex = 2
        saveFileDialog1.RestoreDirectory = True
        If saveFileDialog1.ShowDialog = True Then
            TextBox2.Text = saveFileDialog1.FileName
        End If

e aqui o código do backup e restore...

                                   

Process.Start("C:\Program Files (x86)\EasyPHP-5.3.6.0\mysql\bin\mysqldump.exe", "--user=root --password=password --host=127.0.0.1 --databases nomeBaseDados> -r """ & TextBox2.Text & """")

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.