Hi
Take a look at my code:
private void btnBackUp_Click(object sender, EventArgs e)
{
//backup with service
FbBackup fbbsvc = new FbBackup();
fbbsvc.ConnectionString =
Properties.Settings.Default.AppConnStr;
//take backup location from parameters;
string dbbackup = Functions.GetSystemParameter("SYS",
"SYS_DB_BACKUP");
if (File.Exists(dbbackup) )
{
File.Delete(dbbackup);
}
if (!Directory.Exists(dbbackup))
{
Directory.CreateDirectory(Path.GetDirectoryName(dbbackup));
}
//string backfile =
Path.ChangeExtension(Properties.Settings.Default.AppDataBase, "fbk");
fbbsvc.BackupFiles.Add(new FbBackupFile(dbbackup, 2048));
//fbbsvc.BackupFiles.Add(new
FbBackupFile(Path.ChangeExtension(Properties.Settings.Default.AppDataBase,
"fbk"), 2048));
fbbsvc.Verbose = chkVerbose.Checked;
if (chkIgnoreCheckSum.Checked) { fbbsvc.Options =
FbBackupFlags.IgnoreChecksums; }
if (chkIgnoreLimbo.Checked) { fbbsvc.Options =
FbBackupFlags.IgnoreLimbo; }
if (chkMetadata.Checked) { fbbsvc.Options =
FbBackupFlags.MetaDataOnly; }
if (chkGarbage.Checked) { fbbsvc.Options =
FbBackupFlags.NoGarbageCollect; }
if (chkOldMetadata.Checked) { fbbsvc.Options =
FbBackupFlags.OldDescriptions; }
if (chkConvertTables.Checked) { fbbsvc.Options =
FbBackupFlags.Convert; }
//if (chkTransportable.Checked) {fbbsvc.Options =
FbBackupFlags.NonTransportable ; }
fbbsvc.ServiceOutput += new
ServiceOutputEventHandler(BackupOutput);
lbBackup.Items.Clear();
lbBackup.Items.Add("Start BackUp: " + DateTime.Now.ToString());
fbbsvc.Execute();
lbBackup.Items.Add("End BackUp: " + DateTime.Now.ToString() + "
");
lbBackup.Items.Add(" ");
lbBackup.SelectedIndex = lbBackup.Items.Count - 1;
}
private void BackupOutput(object sender, ServiceOutputEventArgs e)
{
//show the message
switch (cmbOutput.SelectedIndex)
{
case 0:
lbBackup.BeginUpdate();
lbBackup.Items.Add(e.Message);
lbBackup.EndUpdate();
lbBackup.SelectedIndex = lbBackup.Items.Count-1;
lbBackup.Refresh();
break;
case 1:
if (!File.Exists(tbBackupLogFile.Text))
{
using (StreamWriter sw =
File.CreateText(tbBackupLogFile.Text))
{
sw.WriteLine(DateTime.Now.ToString() + " " +
e.Message);
}
}
else
{
using (StreamWriter wr =
File.AppendText(tbBackupLogFile.Text))
{
wr.WriteLine(DateTime.Now.ToString() + " " +
e.Message);
}
}
break;
}
HTH
Paul
From: Rolf Marsh [mailto:rmma...@fastmail.us]
Sent: Tuesday, February 17, 2009 20:15
To: For users and developers of the Firebird .NET providers
Subject: Re: [Firebird-net-provider] Want to run 'gbak.exe' from within
HI Juergen... OK... I'll just leave it at 2048... my major problem is that
I'm getting a message "Cannot attach to services manager service
:service_mgr is not defined" when I try any of the examples at
http://fisheye1.atlassian.com/browse/firebird/NETProvider/NETProvider_17/sou
rce/FirebirdSql.Data.Firebird.UnitTest/FbServicesTests.cs?r=1.10 ... any
idea of where to find out how to fix this? (I have looked everywhere on the
web, found mentions of it, but nothing to indicate how to fix it).
I really appreciate your help...
Rolf
VS-Polis wrote:
Hi Rolf,
I read in the Firebird ADO.NET Provider SDK Documentation and don't
understand this property. The only information I found was an example in the
FbBackup class:
"backupSvc.BackupFiles.Add(new FbBackupFile(@"c:\testdb.gbk", 2048)); "
In the IBExpert documentation I found this information:
"A file size only needs to be specified when working with secondary files."
I suppose this value is unimportant normally.
Juergen
Rolf Marsh schrieb:
I took a look at FirebirdSql.Data.FIrebird.Services namespace, and
decided to try the FbBackup method as a test. In the BackupFiles
method, it asks for the output filename and size... how does one
determine what the size of the output file is going to be prior to doing
the backup?
Rolf
----------------------------------------------------------------------------
--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
--
Juergen Thomas
Verlags-Software
Samlaendische Str. 3
13189 Berlin
Germany
_____
----------------------------------------------------------------------------
--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_____
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider