if (!File.Exists(srcPath))
{
throw new Exception("源数据库不存在,无法备份");
}
try
{
File.Copy(srcPath,aimPath,true);
}
catch(IOException ixp)
{
throw new Exception(ixp.ToString());
}
}
#endregion
#region 还原Access数据库
/// <summary>
/// 还原Access数据库
/// </summary>
/// <param name="bakPath">备份的数据库绝对路径</param>
/// <param name="dbPath">要还原的数据库绝对路径</param>
public static void RecoverAccess(string bakPath,string dbPath)
{
if (!File.Exists(bakPath))
{
throw new Exception("备份数据库不存在,无法还原");
}
try
{
File.Copy(bakPath, dbPath, true);
}
catch (IOException ixp)
{
throw new Exception(ixp.ToString());
}
}
#endregion
}
}








