TAILIEUCHUNG - Create a Detach/Attach SQL Server Database Dialog Box

7,5 Tạo một Tháo / Đính kèm SQL Server cơ sở dữ liệu Dialog Box trạng đôi khi phát sinh đòi hỏi một cơ sở dữ liệu được đính kèm, tách ra, hoặc cả hai. | Create a Detach Attach SQL Server Database Dialog Box Situations sometimes arise that require a database to be attached detached or both. Perhaps your client needs to move the database from one SQL Server to another. This How-To shows you the methods you can use to perform these tasks. Before diving into solving some of the tasks that can be accomplished in the How-Tos just listed it s important to discuss the SQL-DMO object model as well as create a reference to it. Many times you ve used the Enterprise Manager to move databases for users by attaching and detaching them. It would be nice to be able to perform this task without users calling you. At he very least you d like to be able to walk users through the details over the phone without having to use the Enterprise Manager. How do you create a dialog box to perform this task Technique This is probably the easiest of the How-Tos to create for this chapter other than How-To . For this task you will be using two methods of the SQLServer object DetachDB and AttachDBWithSingleFile. Along with the two methods just mentioned you will also be using a Tab control to choose which task to perform as well as an OpenFile Dialog control to allow the user to choose the file to attach. Steps Open and run the -Chapter 7 solution. From the main Windows form click on the command button with the caption How-To . You can select a database such as the one displayed in Figure and click the Detach button. You will see the database disappear from the list of databases to choose from. Figure . Ready to detach the chosen database. After you have chosen the database you can reattach the database by clicking on the tab labeled Attach Database. You can then type in the name you want to attach the database as and click on the Locate File button to locate the database file to attach see Figure . Figure . Choosing the database file to attach. Select the file and click Open. To attach the file click the Attach

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.