0

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
4

1 に答える 1

0

これを試して

 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.RedirectStandardInput = True
        myProcess.StartInfo.RedirectStandardOutput = True
        myProcess.Start()
        Dim myStreamWriter As StreamWriter = myProcess.StandardInput
        Dim mystreamreader As StreamReader = myProcess.StandardOutput
        myStreamWriter.WriteLine(String.Format("C:\wamp\bin\mysql\mysql5.5.24\bin\mysql.exe -u IS_DB -p2240624 db_innovaserver < {0}", "dbFile.sql"))
        myStreamWriter.Close()
        myProcess.WaitForExit()
        myProcess.Close()
    End If
End With

終了機能

于 2013-05-18T11:05:39.243 に答える