TAILIEUCHUNG - Microsoft SQL Server 2005 Developer’s Guide- P50

Microsoft SQL Server 2005 Developer’s Guide- P50:SQL Server 2005 is a feature-rich release that provides a host of new tools and technologies for the database developer. This book is written to help database developers and DBAs become productive immediately with the new features and capabilities found in SQL Server 2005. | Chapter 12 Developing with SMO 469 Private Sub cmdCreateDB_Click ByVal sender As ByVal e As Handles ResetScript Dim sDatabaseName As String Input the database name sDatabaseName InputBox Enter the new database name New Database Try Dim oDatabase As New Database oSQLServer sDatabaseName Add the DB name to the list Catch SQLSMOError End Try End Sub This subroutine begins by declaring a string object called sDatabaseName. The Visual Basic InputBox method is then called to prompt the user to enter a new database name to create and the result is placed into the newly created string sDatabaseName. A new Database object is then instantiated using the current SQL Server instance and sDatabaseName string as parameters. To create the new database on the server the database object s Create method is called. The Create method creates the new database using default property settings however you can also set the database object properties before calling the Create method. Last the list of databases displayed by the SMOSample application is updated with the new name by using the lstDatabases object s method to add the name of the new database to the list of databases. Transferring Tables In addition to creating and manipulating databases SMO is capable of creating and managing tables and other databases objects. Using the SMOSample application a user can copy tables in the selected database to another database on the server by clicking the Transfer Tables button. Clicking the Transfer Tables button executes the cmdTransferTables_Click event subroutine that you can see in the following listing. NOTE To use the Transfer utility class functions from a client system the DTS run time needs to be installed on the client system. 470 Microsoft SQL Server 2005 Developer s Guide The code in the cmdTransferTables_Click subroutine shows how the SMO Transfer utility class can be .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.