Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I have a postgres db 9.3 which i need to do a manual backup from the front end .
It seems to work but the dump files are always 0kb and cannot be used for restore:
VB
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
Posted
Updated 5-Feb-15 2:31am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900