Listing SQL Servers
Thông tin tài liệu:
Nội dung trích xuất từ tài liệu:
Listing SQL Servers[ Team LiB ]Recipe 10.1 Listing SQL ServersProblemYou need to obtain a list of SQL Servers available on the network.SolutionUse SQL Server Distributed Management Objects (SQL-DMO) to retrieve a list ofavailable SQL Servers.Youll need a reference to the Microsoft SQLDMO Object Library from the COM tab inVisual Studio .NETs Add Reference Dialog.The sample code retrieves and displays a list of all SQL Servers running on a localnetwork segment by using SQL-DMO through COM interop.The C# code is shown in Example 10-1.Example 10-1. File: ServerListForm.cs// Namespaces, variables, and constantsusing System;// . . .serverListListBox.Items.Clear( );// Create a SQL Distributed Management Objects (SQL-DMO)// application object.SQLDMO.Application dmo = new SQLDMO.Application( );// Retrieve the available servers.SQLDMO.NameList serverNameList = dmo.ListAvailableSQLServers( );// Iterate over the collection of available servers.for(int i = 0; i < serverNameList.Count; i++){ if (serverNameList.Item(i) != null) serverListListBox.Items.Add(serverNameList.Item(i));}serverListListBox.Items.Add(End of list.);DiscussionSQL Server Distributed Management Objects (SQL-DMO) is a collection of objects thatencapsulate SQL Server database and replication management. SQL-DMO is used toautomate SQL Server tasks, create and administer SQL Server objects, and install andconfigure replication. You can use SQL-DMO from a .NET application through COMinterop. For more information about SQL-DMO, see Microsoft SQL Server BooksOnline.The ListAvailableSQLServers( ) method of the SQL-DMO Application object returns aNameList object that enumerates all running servers that listen on named pipes and arelocated in the same domain. Any servers running on Windows 9x will not be reportedbecause they do not listen on named pipes. The discovery is based on a networkbroadcast, so if you are disconnected from a network, local servers will not beenumerated.This procedure does not return desktop (MSDE) instances.[ Team LiB ]
Tìm kiếm theo từ khóa liên quan:
công nghệ thông tin kỹ thuật lập trình Oreilly Ado Dot Net Cookbook Ebook-Lib Listing SQL ServersGợi ý tài liệu liên quan:
-
52 trang 431 1 0
-
Top 10 mẹo 'đơn giản nhưng hữu ích' trong nhiếp ảnh
11 trang 318 0 0 -
74 trang 302 0 0
-
96 trang 296 0 0
-
Báo cáo thực tập thực tế: Nghiên cứu và xây dựng website bằng Wordpress
24 trang 289 0 0 -
Đồ án tốt nghiệp: Xây dựng ứng dụng di động android quản lý khách hàng cắt tóc
81 trang 283 0 0 -
EBay - Internet và câu chuyện thần kỳ: Phần 1
143 trang 277 0 0 -
Tài liệu dạy học môn Tin học trong chương trình đào tạo trình độ cao đẳng
348 trang 269 1 0 -
Tài liệu hướng dẫn sử dụng thư điện tử tài nguyên và môi trường
72 trang 267 0 0 -
Kỹ thuật lập trình trên Visual Basic 2005
148 trang 266 0 0 -
64 trang 264 0 0
-
Bài giảng An toàn và bảo mật thông tin - Trường đại học Thương Mại
31 trang 255 0 0 -
47 trang 231 0 0
-
Giáo trình Hệ điều hành: Phần 2
53 trang 221 0 0 -
LUẬN VĂN: TÌM HIỂU PHƯƠNG PHÁP HỌC TÍCH CỰC VÀ ỨNG DỤNG CHO BÀI TOÁN LỌC THƯ RÁC
65 trang 216 0 0 -
Đồ án tốt nghiệp: Xây dựng ứng dụng quản lý kho hàng trên nền Web
61 trang 215 0 0 -
83 trang 213 0 0
-
Giáo trình Autocad - Nghề: Quản trị mạng máy tính - Trình độ: Cao đẳng nghề (Phần 2)
52 trang 210 0 0 -
NGÂN HÀNG CÂU HỎI TRẮC NGHIỆM THIẾT KẾ WEB
8 trang 208 0 0 -
BÀI GIẢNG KINH TẾ CHÍNH TRỊ MÁC - LÊNIN - TS. NGUYỄN VĂN LỊCH - 5
23 trang 205 0 0