Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

Vb.net + mysql Backup

ryankai

Amateur
Advanced Member
Messages
113
Reaction score
0
Points
26
Using this code may file lang na nasave pero walang laman. Can anyone help???

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:\Program Files\MySQL\MySQL Server 5.1\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=yourpassword _
-h 192.168.1.201 ""databasename"" > """ + file + """ ")
myStreamWriter.Close()
myProcess.WaitForExit()
myProcess.Close()
MsgBox("Backup Created Successfully!", MsgBoxStyle.Information, "Backup")
End If
End Sub
 
Using this code may file lang na nasave pero walang laman. Can anyone help???

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:\Program Files\MySQL\MySQL Server 5.1\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=yourpassword _
-h 192.168.1.201 ""databasename"" > """ + file + """ ")
myStreamWriter.Close()
myProcess.WaitForExit()
myProcess.Close()
MsgBox("Backup Created Successfully!", MsgBoxStyle.Information, "Backup")
End If
End Sub


Tol ito gawin mo...

1. Create a batch file where it contains the required code for dumping your DB.
2. Create your VB.net code for running targeted files like batch file. TIPS: run your batch file on background mode.

Sana nka tulog ang kunting kaalaman q..
 
Back
Top Bottom