我有一个使用 vb.net 恢复 mysql 数据库的代码。它在 windows 7 中完美运行,但是当我在 windows xp 中尝试时它不起作用。希望大家能帮我解决这个问题。这是我的代码..
Function RestoreDb()
With dlg_openfile 'Executes a series of statements making repeated reference to a single object or structure.
.Title = "Please Select a Image" 'title
.InitialDirectory = "C:\" 'browse start directory
.Filter = "All files (*.*)|*.*|All files (*.*)|*.*" 'only possible to select this extensions
.FilterIndex = 0 'index number filter
.FileName = "" 'empty
Dim answ = .ShowDialog
If answ = DialogResult.OK Then 'if answer not cancel, etc..
Dim myProcess As New Process()
myProcess.StartInfo.FileName = "cmd.exe"
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.WorkingDirectory = "C:\wamp\bin\mysql\mysql5.5.24\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(String.Format("mysql -u IS_DB -p2240624 db_innovaserver < {0}", .FileName))
myStreamWriter.Close()
myProcess.WaitForExit()
myProcess.Close()
End If
End With
End Function