In few months ago I was finding a way to backup mysql database. After those time again I found some intersting code part from web. I really thanks for first owner of this amazing code. I will put it below. But first, I must said one thing I'm just unsure at line : 16 therefore we need expertiese ideas to prove this codes 100% work.

 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:\Program Files (x86)\MySQL\MySQL Server 5.0\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=mysql _-h localhost ""moneycs"" > """ + file + """ ")
                myStreamWriter.Close()
                myProcess.WaitForExit()
                myProcess.Close()
                MsgBox("Backup Created Successfully!", MsgBoxStyle.Information, "Backup")

Please give your advice for line no 16 code : is it true or false ? if false please correct it for thousand of coders.

I think you are very lazy
just put the line in visual studio and you see the string is not properly formatted double quotes should be escaped

I'm calling BS that you found this "amazing code" on the internet and that you want it corrected for "thousands of coders". How about a link? Is this your code? Im also with TexWiller on this one. Plug it into your IDE and see if any errors pop up. If they do, perhaps the code isn't so amazing after all. :)

mysqldump is the command line function that exports all or part of a database to the specified file.
So you are taking all of the database 'moneycs' and outputting it to whatever file name you suply.

It's perfectly acceptable MySql

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.