I use below code to backup mySQL database. I want to save sql database by save file dialog.
I use this,
Sub CreateBackupc()
Dim mysqldumpPath As String = "C:\Program Files (x86)\MySQL\MySQL Server 5.0\bin\mysqldump.exe"
Dim host As String = "localhost"
Dim user As String = "root"
Dim pswd As String = "mysql"
Dim dbnm As String = "mcs"
Dim cmd As String = String.Format("-h{0} -u{1} -p{2} {3}", host, user, pswd, dbnm)
SaveFileDialog1.Filter = "SQL Files (*.sql*)|*.sql"
If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK _
Then
My.Computer.FileSystem.WriteAllText _
(SaveFileDialog1.FileName, "mcs.sql", True)
Dim startInfo As System.Diagnostics.ProcessStartInfo = New System.Diagnostics.ProcessStartInfo()
startInfo.FileName = mysqldumpPath
startInfo.Arguments = cmd
startInfo.RedirectStandardError = True
startInfo.RedirectStandardInput = False
startInfo.RedirectStandardOutput = True
startInfo.UseShellExecute = False
startInfo.CreateNoWindow = True
startInfo.ErrorDialog = False
Dim proc As System.Diagnostics.Process = New System.Diagnostics.Process()
proc.StartInfo = startInfo
AddHandler proc.OutputDataReceived, AddressOf OnDataReceivedc
proc.Start()
proc.BeginOutputReadLine()
proc.WaitForExit()
OutputStreamc.Flush()
OutputStreamc.Close()
proc.Close()
End If
End Sub
but it save richbox text to sql type file