C# Tutorial – Backup Database SQL Server | FoxLearn

C# Tutorial – Backup Database SQL Server | FoxLearn


Welcome to the FoxLearn Today we will learn how to backup a database First, We will design a simple UI allows you to connect to the sql server, then you can enter database name for backup You need to include in your project 4 libraries The type of device you going to backup: Database, Files or Log The SQL Database name you need to backup Keep in mind that the file path you use here is relative to the SQL Server, not your local file system Leaving the Initialize value set to the default of false will create a new backup item as the last backup set If you change the Initialize value to true then this backup set will become the first backup set and will overwrite other backups that have the same BackupSetName If you use multithreading to improve the performance of your Windows Forms applications you must make sure that you make calls to your controls in a thread-safe way Access to Windows Forms controls is not inherently thread safe If you have two or more threads manipulating the state of a control, it is possible to force the control into an inconsistent state Other thread-related bugs are possible, such as race conditions and deadlocks It is important to make sure that access to your controls is performed in a thread-safe way The .NET Framework provides methods that are safe to call from any thread for invoking methods that interact with controls owned by other threads The Invoke method allows for the synchronous execution of methods on controls, whereas the BeginInvoke method initiates asynchronous execution To use these methods, you must declare a delegate with the same signature as the method you will be invoking Then you can call the Invoke or BeginInvoke method of any control on the form by supplying the appropriate delegate to the method you want to call Thank you for watching this video

Danny Hutson

43 thoughts on “C# Tutorial – Backup Database SQL Server | FoxLearn

  1. i want to backup as many files with specific e.g. Northwind-Jan-2-2017…
    is it okay?… do i need to alter some codes from it?
    or will i make the filepath dynamic?

  2. There was error for me, because I have VS 2013 , I replaced with string.Format("{0}%",e.Percent) as you said , but nothing happened . please help..

  3. I found a problem, If I already have a .bak , using this instructions the .bak its replaced. How may I do an adition (I mean, the same file that I already have just grows in size)instead of a replace of the flie?

  4. Error 7 The type 'Microsoft.SqlServer.Management.Sdk.Sfc.IAlienObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.SqlServer.Management.Sdk.Sfc, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'. C:UsersMohamedDesktopRay_ConnectRay_ConnectRay_ConnectForm_backup.cs 55 17 Ray_Connect

    hi the error fix Please

  5. Thanks for the tutorial it work so fine, I just have two details, the progress bar doesn't work and the second it's when I realize a backup from the server the file size is 2.4 gb and when I use this code the file size is 842 mb, is there a problem with my code?, can you send me the sourse code? [email protected]

Leave a Reply

Your email address will not be published. Required fields are marked *