如何在vb.net中备份和恢复数据库mysql我使用xampp。但是当备份过程开始时,加载他的生活进度条。
这是我的编码:
Private Sub btnBackup_Click(ByVal sender As System.Object, _ByVal e As System.EventArgs) Handles btnBackup.Click
Dim file As String
sfd.Filter = "SQL Dump File (*.sql)|*.sql|All files (*.*)|*.*"
sfd.FileName= "Database Backup " + DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss") + ".sql"
If sfd.ShowDialog = DialogResult.OK Then
file = sfd.FileName
Dim myProcess As New Process()
myProcess.StartInfo.FileName = "cmd.exe"
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.WorkingDirectory ="C:\xampp/mysql/bin"
myProcess.StartInfo.RedirectStandardInput = True
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.Start()
Dim myStreamWriter As StreamWriter= myProcess.StandardInput
Dim mystreamreader As StreamReader = myProcess.StandardOutput
myStreamWriter.WriteLine("mysqldump -u root --password=1 _ -h 127.0.0.1 ""minimart"" > """ file """ ")
myStreamWriter.Close()
myProcess.WaitForExit()
myProcess.Close()
MsgBox("Backup Created Successfully!", MsgBoxStyle.Information, "Backup")
EndIf
End Sub
所以我想在带有进度条
的储物柜中的命令提示符处加载进程