I've got application which contains a database based on Postgresql. I wannna get a backup of this database using my application. for ex. I wanna click an option in program menu and wanna get file with database backup. I got all administratior rights for this database. Application is wrtitten in .net 4.0 (C#), windows forms.
How could I solve my problem?
i' ve tried it but it's not working:
string zapytanie = @"pg_dump WFR > C:\kopia";
string pol = Ustawienia.ConnectionString;
NpgsqlConnection conn = new NpgsqlConnection(pol);
conn.Open();
NpgsqlCommand comm = conn.CreateCommand();
comm.CommandText = zapytanie;
comm.ExecuteNonQuery();
conn.Close();
errors:
ERROR: 42601: syntax error at or near "pg_dump"
stacktrace:
w Npgsql.NpgsqlState.<ProcessBackendResponses_Ver_3>d__a.MoveNext()
w Npgsql.ForwardsOnlyDataReader.GetNextResponseObject()
w Npgsql.ForwardsOnlyDataReader.GetNextRowDescription()
w Npgsql.ForwardsOnlyDataReader.NextResult()
w Npgsql.ForwardsOnlyDataReader..ctor(IEnumerable`1 dataEnumeration, CommandBehavior behavior, NpgsqlCommand command, NotificationThreadBlock threadBlock, Boolean synchOnReadError)
w Npgsql.NpgsqlCommand.GetReader(CommandBehavior cb)
w Npgsql.NpgsqlCommand.ExecuteNonQuery()
w Faktury_i_Rachunki_2.Forms.FrmKopiaBezp.BtUtworzKopie_Click(Object sender, EventArgs e) w D:\nwfr3\Faktury i Rachunki 2.0\Forms\FrmKopiaBezp.cs:wiersz 38
postgresql backup command. Explain why if those commands are not enough for you