Hi,
In addition to
Ger Hayden Solution, you must also
consider the
Time out, cause backup sometimes take
too long.
Example code:
In your Web.config you have:
<add name="ClaimsORAConnection" connectionString="Provider=MSDAORA;Data Source=Your serverName;User ID=YourUserId;Password=YourPassword"/>
and then in your code behind:
OleDbCommand ocmd = new OleDbCommand();
string strConn = ConfigurationManager.ConnectionStrings["ClaimsORAConnection"].ConnectionString.ToString();
OleDbConnection aConn = new OleDbConnection((strConn + ";Connection Timeout=300; pooling='true';Max Pool Size=300"));
string strQry = "backup database databasename to disk ='C:\databasename.bak'"
try
{
ocmd.CommandTimeout = 300;
ocmd = new System.Data.OleDb.OleDbCommand(strQry, aConn);
ocmd.ExecuteNonQuery();
}
catch (Exception)
{
return "Backup process failed...";
}
finally
{
ocmd.Dispose();
aConn.Close();
}
The
Connection Timeout should be fair with
Command Timeout otherwise
process catch Timeout.
You may adjust the Time out duration from 300 or more,
depending in time of process
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Hope this could help.
Regards,
Algem