Sub executeCommand(ByVal commandType As String, ByVal commandSentence As String) Try Dim info As New ProcessStartInfo() info.FileName = Application.StartupPath & "\Reports\" + commandType + ".exe " info.Arguments = commandSentence info.CreateNoWindow = True info.UseShellExecute = False proc.StartInfo = info proc.Start() proc.WaitForExit() If commandType = "pg_dump" Then KryptonLabel1.Text = "Backup successfully created" ElseIf commandType = "pg_restore" Then KryptonLabel1.Text = "Restore successfully executed" End If Catch ex As Exception KryptonLabel1.Text = ex.ToString() End Try End Sub Private Sub KryptonButton4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KryptonButton4.Click '-W " + password + " Dim xxx As String = "-i -h " & hostName & " -p " & strPort & " -U " & userName & " --no-password -F c -b -v -f " & Label2.Text & " " & txtDB ' xxx = " -U postgres -h 127.0.0.1 -p 5432 -F p -f F:\FileName1.backup -w postgres" executeCommand("pg_dump", xxx) End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)