Note that there are some explanatory texts on larger screens.

plurals
  1. PORestore database of more than 10MB size using C# showing error
    text
    copied!<p>I am using this command For restoring my database using C#</p> <pre><code>private void btn_restore_Click(object sender, EventArgs e) { intializeConnections(); intializeDataServer(); if ((txt_bakfile.Text.ToString()!="") &amp;&amp;(txt_bakfile.Text !="System.Data.DataRow")) { Thread oThread = new Thread(new ThreadStart(frmWaitShow)); // clsLogs.LogEvent(4, "Tread is call"); oThread.Start(); // Create a new database restore operation Restore rstDatabase = new Restore(); // Set the restore type to a database restore rstDatabase.Action = RestoreActionType.Database; // Set the database that we want to perform the restore on rstDatabase.Database = DatabaseName; // Set the backup device from which we want to restore, to a file BackupDeviceItem bkpDevice = new BackupDeviceItem(txt_bakfile.Text.ToString(), DeviceType.File); // Add the backup device to the restore type rstDatabase.Devices.Add(bkpDevice); // If the database already exists, replace it rstDatabase.ReplaceDatabase = true; // Perform the restore rstDatabase.SqlRestore(srvSql); oThread.Abort(); } } </code></pre> <p>Function are :</p> <pre><code> public void intializeConnections() { string connString = SqlHelper.ConString; SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(connString); serverName = builder.DataSource; DatabaseName = builder.InitialCatalog; UserId = builder.UserID; pw = builder.Password; } private void intializeDataServer() { // Create a new connection to the selected server name ServerConnection srvConn = new ServerConnection(serverName); // Log in using SQL authentication instead of Windows authentication srvConn.LoginSecure = false; // Give the login username srvConn.Login = UserId; // Give the login password srvConn.Password = pw; // Create a new SQL Server object using the connection we created srvSql = new Server(srvConn); } </code></pre> <p>This works perfectly for my all databases which have a size of less than 10MB, but when I am trying to restore my one database which has size of more than 10MB, it's showing an error</p> <blockquote> <p>Restore failed for Server 'VARUN-PC'</p> </blockquote> <p><img src="https://i.stack.imgur.com/HSLR7.jpg" alt="enter image description here"></p> <p><img src="https://i.stack.imgur.com/EIb7Q.jpg" alt="enter image description here"></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload