我有一个带有 MySQL 数据库的 VB.NET 项目。我想恢复我的备份数据库文件。我有一个代码可以工作,但我是用户通过OpenfileDialog
.
这是我的代码:
restoreDirectory = OpenFileDialog1.FileName.ToString()
Dim myProcess As New Process()
myProcess.StartInfo.FileName = "cmd.exe"
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.WorkingDirectory = "C:\wamp\bin\mysql\mysql5.5.20\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("mysql -u root mssa < " & restoreDirectory & " ")
myStreamWriter.Close()
myProcess.WaitForExit()
myProcess.Close()
我确定我得到了正确的文件路径,但它不起作用。我错过了什么吗?