Ver Mensaje Individual
  #8 (permalink)  
Antiguo 16/02/2010, 07:05
Avatar de Frehley
Frehley
 
Fecha de Ingreso: junio-2005
Ubicación: Somewhere between Heaven and Hell
Mensajes: 415
Antigüedad: 21 años, 3 meses
Puntos: 0
Respuesta: Argumentos para mysql.exe

SSSSSIIIII!!!! POR FIN!!!!!!! Les dejo el codigo para el que lo necesite!

Código PHP:
        Clave = txtClave.Text
        Database 
= txtDatabase.Text
        Host 
= txtHost.Text
        Puerto 
= txtPuerto.Text
        User 
= txtUser.Text

        Dim back 
As String = Chr(34) & Application.StartupPath & "\backup.sql" & Chr(34)
        
Dim mysqlll As String = Chr(34) & Chr(34) & Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\MySQL\MySQL Server 5.0\bin\mysql.exe" & Chr(34)
        
Dim xx As String = mysqlll & " --host=" & Host & " --port=" & Puerto & " --user=" & User & " --password=" & Clave & " < " & back


        Dim Command 
As New Process 'Creamos la instancia Process
        Command.StartInfo.FileName = "cmd.exe" '
El proceso en si es el CMD 
        Command
.StartInfo.Arguments = " /c " & xx 'Aqui le damos los parametros /c y el nombre del archivo a ejecutar

        Command.StartInfo.RedirectStandardError = True '
Redirigimos los errores
        Command
.StartInfo.RedirectStandardOutput = True 'Redirigimos la salida
        Command.StartInfo.UseShellExecute = False '
Para redirigir la salida de este proceso esta propiedad debe ser false
        Command
.StartInfo.CreateNoWindow = True 'Para que no abra la ventana del CMD

        Try
            Command.Start()
            Dim Output As String = Command.StandardOutput.ReadToEnd() _
        & vbCrLf & Command.StandardError.ReadToEnd() '
Guardamos las salidas en un string
            TextBoxX1
.Text = ""
            
TextBoxX1.Text = Output 'Desplegamos la salida en nuestro RichTextBox
            MsgBox("la base de datos ha sido creada")
        Catch ex As Exception
            MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            '
En caso de cualquier error de ejecucion
        End 
Try 
Salu2 y muchas gracias!!
__________________
diegoz.com.ar