tailieunhanh - Restore a SQL Server Database
Khôi phục một cơ sở dữ liệu SQL Server Đôi khi người sử dụng cần để khôi phục lại cơ sở dữ liệu, và một lần nữa, nó là tốt đẹp nếu anh ta không có để đi đến Enterprise Manager để hoàn thành nhiệm vụ này. Điều này thế nào-Để giải thích làm thế nào để sử dụng đối tượng Khôi phục từ SQL-DMO để hoàn thành nhiệm vụ này | Restore a SQL Server Database Sometimes the user needs to restore a database and again it is nice if he doesn t have to go to Enterprise Manager to accomplish this task. This How-To explains how to use the Restore object from SQL-DMO to accomplish this task. It s all well and good to be able to back up and verify a SQL Server database but what about being able to restore the database if necessary How do you create a dialog box to restore a SQL Server database Technique For this How-To you will use the Restore object of the SQL-DMO object model. You can see the properties and methods that will be used in Table . Table . Properties and Methods of the Restore Object Property Method Description Action This property allows you to specify what type of backup you want to take place. The choices are found in the namespace and are SQLDMORestore_Database SQLDMORestore_Files SQLDMORestore_Log. Database This property allows you to specify the database name to restore to. Devices This property shows which device s you are restoring from. ReplaceDatabase This property tells whether to replace the database. SQLRestore This method causes the restore to be executed. Using the objects listed in Table you will create a form with options for the user to restore his database. Steps Open and run the -Chapter 7 solution. From the main Windows Form click on the command button with the caption How-To . You will then see the form displayed in Figure . Figure . This form restores a SQL Server database. As with How-To a user clicks on the SQL Server for which he wants to display the databases. He can then choose the database and backup device. From there the user can click the Restore button to restore the database. 1. Create a Windows Form. Then place the controls shown in Figure with the following properties set as in Table . Table . Label ListBox DataGrid and Command Button Controls Property Settings Object Property .
đang nạp các trang xem trước